I am using the following code to create a directory if it does not exist. If cell C4 has “12400” then a directory “12400-12499” is created i.e. "S:\MTL_DATA\Quotes\12400-12499".
I wish to know how to modify this code so that another sub directory is created, in this case “12400” i.e. "S:\MTL_DATA\Quotes\12400-12499\12400". If cell C4 has 12401 then "S:\MTL_DATA\Quotes\12400-12499" remains but a new sub directory is “12401” i.e. "S:\MTL_DATA\Quotes\12400-12499\12401".
Thanks Sandy
Dim fname As Integer
Dim oname As Integer
Dim dirname As Integer
Dim dirnameM As String
Dim dirnamesub As Integer
fname = Range("C4")
dirname = Int(fname / 100) * 100
dirnameM = dirname & " - " & dirname + 99
dirnamesub = Range("C4") 'fname
If Dir("S:\MTL_DATA\Quotes" & "\" & dirnameM, vbDirectory) = "" Then
MkDir "S:\MTL_DATA\Quotes" & "\" & dirnameM
End If
Bookmarks