I need an excel sheet to creating a new folder every month, and save a new spreadsheet every day, un

  • Thread starter Thread starter Sol
  • Start date Start date
S

Sol

So for every day in sep, it will save a file to the folder marked "Sep
2006", then in Oct it will create a new folder "Oct 2006" and save
there for the rest of the month.

Thanks for your help in advance
 
Try this macro

It create the folder in C
Change monthnumber = 9 to the month you want
It save a copy of the workbook for every day in the month

Sub test()
Dim monthnumber As Integer
Dim monthDays As Integer

monthnumber = 9

On Error Resume Next
MkDir "C:\" & Format(DateSerial(2006, monthnumber, 1), "mmm")
On Error GoTo 0

monthDays = DateSerial(2006, monthnumber + 1, 1) - DateSerial(2006, monthnumber, 1)

For I = 1 To monthDays
ThisWorkbook.SaveCopyAs "C:\" & Format(DateSerial(2006, monthnumber, 1), "mmm") & "\" & I & ".xls"
Next I
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top