ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto Fill workshseet tabs? (https://www.excelbanter.com/excel-discussion-misc-queries/38254-auto-fill-workshseet-tabs.html)

Sandy@theblade

Auto Fill workshseet tabs?
 
I have a workbook with a page for each day of the month, named for the day
and date. I need to copy it for each month. Can I auto fill the tabs on the
worksheets like I would a column?

Dave Peterson

Maybe a little macro???

Option Explicit
Sub testme()

Dim iCtr As Long
Dim myDate As Date

myDate = DateSerial(2005, 8, 1)

For iCtr = DateSerial(Year(myDate), Month(myDate), 1) _
To DateSerial(Year(myDate), Month(myDate) + 1, 0)
Worksheets.Add after:=Worksheets(Worksheets.Count)
On Error Resume Next
ActiveSheet.Name = Format(iCtr, "dddd mm_dd_yyyy")
If Err.Number < 0 Then
MsgBox "Error with date: " & Format(iCtr, "mm/dd/yyyy")
Err.Clear
Application.DisplayAlerts = False
ActiveSheet.Delete
Application.DisplayAlerts = True
End If
On Error GoTo 0
Next iCtr

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

(ps. I used August of 2005 for the month to add.)

Sandy@theblade wrote:

I have a workbook with a page for each day of the month, named for the day
and date. I need to copy it for each month. Can I auto fill the tabs on the
worksheets like I would a column?


--

Dave Peterson


All times are GMT +1. The time now is 06:23 AM.

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