At the end of each year (i.e. on every December 31) I want to create a new Excel Workbook (spreadsheet). Thus on December 31, 2008, I want to create a workbook called 2009. Now at the day 1of each month in 2009, I want to create a worksheet named after that month. So for on Jan 31, 2009, I want to create a worksheet called January in the workbook 2009. Clearly I have to use a loop to generate the worksheets but I will go a SELECT CASE instead. Also I am inclined to go with an "IF...ELSE" statement for the creation of the workbooks.
The skeleton of my code would probably be along these lines:
I am yet to provide the actual coding according to the above guide. Any expert can test out my guide with a real code and let me know if it works. I am working on it and I will let you guys know how far I get and what errors I generate.
Thanks guys!!
The skeleton of my code would probably be along these lines:
Code:
If Format(Now, "dd-mmm") = 01-Feb
Create workbook named [Format(Now, "yyyy")] and a worksheet named [DateAdd("m",-1,Date()]and dump in Location "x".
Else
Select Case MonthDay (Where MonthDay = Format(Now, "dd-mmm") )
Case 01-March
Create Worksheet named [DateAdd("m",-1,Date()] in workbook named [Format(Now, "yyyy")]
Case 01-April
Create Worksheet named [DateAdd("m",-1,Date()] in workbook named [Format(Now, "yyyy")]
.
.
.
Case 01-Dec
Create Worksheet named [DateAdd("m",-1,Date()] in workbook named [Format(Now, "yyyy")]
Case 01-Jan
Create Worksheet named [DateAdd("m",-1,Date()] in workbook named [Format(Now, "yyyy")]
Thanks guys!!
Comment