View Single Post
 
Old 05-23-2015, 12:53 AM
Jackie Jackie is offline Windows 8 Office 2013
Novice
 
Join Date: Nov 2014
Posts: 18
Jackie is on a distinguished road
Default macro to automatically date sheet tab

Hi

I have found this macro that automatically names the tab for a sheet. Does anyone know how to change the macro to allow a date as a tab name?

Thank you..............complete macro novice

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("A1")
If Target = "" Then Exit Sub
On Error GoTo Badname
ActiveSheet.Name = Left(Target, 31)
Exit Sub
Badname:
MsgBox "Please revise the entry in A1." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("A1").Activate
End Sub
Reply With Quote