ads_3131
10-31-2008, 02:57 AM
Hello, Advancing on creating directories to also creating sub directories. Below is the code for Creating a directory from a list in column A. (which works) to create the directories i list, but below that i have found a code which helps to make subdirectories in a way but putting them together isn't working for me too well. Now that i have a list of what the directories are going to be in column A i need to put a list of the 1st subdirectory in column b, then 2nd in C and so on. It must be possible I just need help as i am all new and learning lol. Thanks
--------------------------------------------------------------
Public Sub ProcessData()
Const ROOT_FOLDER As String = "C:\Documents and Settings\Administrator\My Documents\Other\Test\"
Dim LastRow As Long
Dim i As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
On Error Resume Next
For i = 1 To LastRow
MkDir ROOT_FOLDER & .Cells(i, "A").Value
Next i
On Error GoTo 0
End With
End Sub
--------------------------------------------------------
Sub MakeDirectories()
' Declare variable for creating folders...
Dim Dir1 As String, Dir2 As String, Dir3 As String
' Assign directories location and its name...
Dir1 = "C:\MainFolder"
Dir2 = Dir1 & "\SubFolder1"
Dir3 = Dir1 & "\SubFolder2"
' Create folders...
On Error Resume Next
MkDir (Dir1)
MkDir (Dir2)
MkDir (Dir3)
On Error GoTo 0
End Sub
--------------------------------------------------------------
Public Sub ProcessData()
Const ROOT_FOLDER As String = "C:\Documents and Settings\Administrator\My Documents\Other\Test\"
Dim LastRow As Long
Dim i As Long
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
On Error Resume Next
For i = 1 To LastRow
MkDir ROOT_FOLDER & .Cells(i, "A").Value
Next i
On Error GoTo 0
End With
End Sub
--------------------------------------------------------
Sub MakeDirectories()
' Declare variable for creating folders...
Dim Dir1 As String, Dir2 As String, Dir3 As String
' Assign directories location and its name...
Dir1 = "C:\MainFolder"
Dir2 = Dir1 & "\SubFolder1"
Dir3 = Dir1 & "\SubFolder2"
' Create folders...
On Error Resume Next
MkDir (Dir1)
MkDir (Dir2)
MkDir (Dir3)
On Error GoTo 0
End Sub