Rename excel workbook sheet in macro


Posted by Jerry on November 13, 2001 9:56 PM

I want to change the name of every new sheet I insert,thru a macro once daily, to the day's date. Will recording the macro in the template accomplish this or how do I do this? Can it be done?

Posted by Paul Akkermans on November 14, 2001 1:28 AM

Dim nameq As String

nameq = Format(Date, "Long Date")
Sheets.Add
ActiveSheet.name = nameq



Posted by Dank on November 14, 2001 1:34 AM

Something like this?

Sub AddASheetAndNameIt()
Dim shtNew As Worksheet
Set shtNew = Worksheets.Add
shtNew.Name = Format(Now(), "dd-mm-yy")
End Sub

Regards,
Daniel.