Sheet for each month

  • Thread starter Thread starter davegb
  • Start date Start date
D

davegb

Is there a way to create a workbook with sheets for each month without
typing in the names of each month manually?
TIA
 
Hi Dave

not sure if this is the neatest way but it seems to work:
insert your twelve worksheets (easiest way to do this is in excel choose
tools / options /general - change sheets in new workbook to 12, open a new
workbook and then change the setting back to 3)

then run the following code
----
Sub namesheets()
Dim i As Date
i = DateValue("5-Jan-2005")
For Each ws In Worksheets
ws.Name = Format(i, "mmm")
i = i + 30
Next
End Sub
----

to use the code, right mouse click on a sheet tab, choose view code, in the
VBE window choose insert / module from the menu - copy & paste the code in
there, use ALT & F11 to switch back to your workbook and then choose tools /
macro / macros, find the namesheets macro and run it.

hope this helps
Cheers
julieD
 

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