My spreadsheet is a diary that staff enter their booked hours of working for a 4 week period. So on the 2nd tab is a table that holds the 4 week commencing dates (and other info irrelevant to this macro), the 3rd sheet is the 1st wc diary and so on until the 5th sheet. ok, so I've worked on my spreadsheet some more and have found the macro to date a tab.
The tab dates come from the cell E3 that are populated from sheet 1 which holds the 4 wc dates I want for the 4 week diary.
The tab dates work fine, except I have to click in a cell on each sheet to make the tab change date name. Is there anyway that the tab date names can change by just entering the dates in sheet 1......thank you
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Set Target = Range("E3")
If Target = "" Then Exit Sub
On Error GoTo Badname
ActiveSheet.Name = Format(Target, "dd-mm-yy")
Exit Sub
Badname:
MsgBox "Please revise the entry in E3." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("E3").Activate
End Sub
Last edited by Jackie; 05-23-2015 at 06:16 PM.
Reason: workbook sheets changed
|