Creating folder names from column data in excel

  • Thread starter Thread starter primed
  • Start date Start date
P

primed

Hi,

I have a list of names in excel, approx 500 long. I need to create a folder
for each one. How do i do it automatically?

Thanks
 
You would use the MkDir statement to do that... it requires you specify the
full path as its argument. This is the description provided in the help
files...

"Creates a new directory or folder.

Syntax: MkDir path

The required path argument is a string expression that
identifies the directory or folder to be created. The path
may include the drive. If no drive is specified, MkDir
creates the new directory or folder on the current drive."
 
Try the below

Sub Macro()
Dim cell As Range
For Each cell In Range("A1:A500")
MkDir "c:\" & cell.Text
Next
End Sub
 
Excellent, Thankyou.

I had to try it a few times as the list contained data that went against
file naming conventions.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top