How do I name tabs with dates for the rest of the year?

J

jdhx3

I am looking to be able to name tabs with individual days (November 9,
November 10 etc.) for the rest of the year without having to type each tab
title. Is there a way to do this? I have looked online in several places but
have not found an answer.
 
D

Dave Peterson

One way with that VBA macro:

Option Explicit
Sub testme01()

Dim iCtr As Long
Dim FirstDate As Date
Dim LastDate As Date
Dim myName As String
Dim wks As Worksheet

FirstDate = Date 'dateserial(2004,11,09) 'for a specific date
LastDate = DateSerial(Year(FirstDate), 12, 31)

On Error Resume Next
For iCtr = FirstDate To LastDate
myName = Format(iCtr, "mmmm dd")
Set wks = Worksheets.Add(after:=Worksheets(Worksheets.Count))
wks.Name = myName
If Err.Number <> 0 Then
'MsgBox "oh, oh with: " & myName
Beep
Err.Clear
Application.DisplayAlerts = False
wks.Delete
Application.DisplayAlerts = True
End If
Next iCtr
On Error GoTo 0
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
 
Top