Solved need a simple excel macro to create 31 sheets and name them

Microsoft Office excel 2007 - upgrade
April 3, 2012 at 13:26:30
Specs: Windows XP
need a simple excel macro to create 31 sheets and name them for the date
example:
sheet 1 is named 05-1
sheet 2 is named 05-2
sheet 3 is named 05-3
etc for the whole month to 05-31

See More: need a simple excel macro to create 31 sheets and name them

Report •

#1
April 3, 2012 at 13:46:53
✔ Best Answer
Assuming that you are starting with a "standard" new workbook with 3 blank worksheets, this code will result in 31 sheets named as you requested...

Sub DateSheets()
'Rename Sheets 1 - 3
  For sht = 1 To 3
     Sheets(sht).Name = "05-" & sht
  Next
'Add and Name sheets 4 - 31
  For sht = 4 To 31
     Sheets.Add after:=Sheets(Sheets.Count)
     Sheets(Sheets.Count).Name = "05-" & sht
  Next
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
April 3, 2012 at 14:27:52
thank you, this will work perfectly for me.

Report •
Related Solutions


Ask Question