Option Explicit
Sub CreateFolders()
Dim Cell As Range
Dim MyPath As String
Dim MyRange As Range
MyPath = ThisWorkbook.Sheets(1).Cells(2, 1)
Set MyRange = Range(Cells(3, 3), Cells(3, 3).End(xlDown))
For Each Cell In MyRange
On Error Resume Next
MkDir MyPath & "\" & Cell.Value
If Err.Number > 0 Then
Cell.Offset(0, 1).Value = "Some error occurred"
End If
Next Cell
End Sub
Hi I don't know about subfolders but I use below code if I have to create multiple folders at once.
Code:Option Explicit Sub CreateFolders() Dim Cell As Range Dim MyPath As String Dim MyRange As Range MyPath = ThisWorkbook.Sheets(1).Cells(2, 1) Set MyRange = Range(Cells(3, 3), Cells(3, 3).End(xlDown)) For Each Cell In MyRange On Error Resume Next MkDir MyPath & "\" & Cell.Value If Err.Number > 0 Then Cell.Offset(0, 1).Value = "Some error occurred" End If Next Cell End Sub
With Regards
Rudra
Hi,
Are you looking for something like this?
P.S. I have not tested your code.Code:sDir = "E:\" & InputBox("Enter your Path", " Path Please")
With Regards
Rudra
Yes. I never finished with it. But wasn't that what you asked for?Thank you Shrivallabha,
Only Create foders tab working, other tabs not working. i am using 2010 excel