Create folder name with timestamp and create 4 additional folders within new folder help.

iP_123

Board Regular
Joined
Apr 18, 2016
Messages
99
Good evening,

Is there a way using macro to create a month folder with a time stamp? The folder name will be the month name in cell B3 of sheet1 and can the time stamp be HH:MM:SS? Lastly can the macro create 4 additional folders within the newly created folder, if that is possible.
The four folders can be named based on the names in cell A1:A4 on sheet1.

I appreciate the assistance.

ip
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try this.

Code:
Sub MakeFolders()
Dim FSO As Object:      Set FSO = CreateObject("Scripting.FileSystemObject")
Dim Path As String:     Path = "C:\Users\USERNAME\Desktop\" 'Change to your needs
Dim Mnth As String:     Mnth = Range("B3").Value
Dim AR() As Variant:    AR = Range("A1:A4").Value

Path = Path & Mnth & " " & Format(Now(), "hh.nn.ss")
FSO.createfolder Path

For i = LBound(AR) To UBound(AR)
    FSO.createfolder Path & "\" & AR(i, 1)
Next i

Set FSO = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,198
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top