View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_1396_] Rick Rothstein \(MVP - VB\)[_1396_] is offline
external usenet poster
 
Posts: 1
Default Create folders from excel

I'm going to guess that the path is not included with the names in the
cells...

Sub MakeDirectories()
Dim n As Integer
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
MkDir "c:\" & Cells(i, 1).Value
Next
End Sub

Also note I removed the parentheses from around the argument to MkDir...
doesn't hurt in this case, but using them when they are not required by
syntax can cause errors in a lot of cases.

Rick


"Gary''s Student" wrote in message
...
Sub MakeDirectories()
Dim n As Integer
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
MkDir (Cells(i, 1).Value)
Next
End Sub
--
Gary''s Student - gsnu200772