ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   I need an excel sheet to creating a new folder every month, and save a new spreadsheet every day, untill the next month, when it creates a new folder (https://www.excelbanter.com/excel-programming/372255-i-need-excel-sheet-creating-new-folder-every-month-save-new-spreadsheet-every-day-untill-next-month-when-creates-new-folder.html)

Sol[_3_]

I need an excel sheet to creating a new folder every month, and save a new spreadsheet every day, untill the next month, when it creates a new folder
 
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


Ron de Bruin

I need an excel sheet to creating a new folder every month, and save a new spreadsheet every day, untill the next month, when it creates a new folder
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Sol" wrote in message oups.com...
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





All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com