• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Delete Directory With Same Name in Column B

dparteka

Member
RmDir "H:\Public\" & Cells(Application.ActiveCell.Row, 2).Select

Above is my amateurish attempt to make a macro that deletes a directory that has the same name that is in column “B” of the selected row… H:\Public\ never changes but everything to the right which is the same as text in column “B” is always different (e.g. 1234A), I think I’m close but can’t get past the finish line… any help will be appreciated, thank you for the help.
 
It's the Select at the end that's messing you up. Change to this:
Code:
RmDir "H:\Public\" & Cells(ActiveCell.Row, 2).Value

Note also that per help file on the RmDir method:

An error occurs if you try to use RmDir on a directory or folder containing files. Use the Kill statement to delete all files before attempting to remove a directory or folder.
 
Back
Top