Forum Discussion
Worksheet tabs to include date from a cell
You can do this with a simple VBA macro, since sheet names can’t be linked directly to cells. Add this code to the relevant sheets in the VBA editor (Alt+F11):
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("H1")) Is Nothing Then
Dim dt As String
dt = Format(Me.Range("H1").Value, "dd-mmm-yyyy")
Select Case Me.CodeName
Case "Sheet1" ' adjust to your sheet code name
Me.Name = "AR - as of " & dt
Case "Sheet3"
Me.Name = "AP - as of " & dt
End Select
End If
End Sub
Whenever H1 changes, the tab name updates automatically.
- rbellmanJan 05, 2026Copper Contributor
Thank you - this is very close to what I am looking for. Cell H1 on tab 3 is linked to cell H1 on tab 1, so H1 on tab 3 updates automatically when I update the date in H1 on tab 1. Unfortunately, the date in the tab name on tab 3 doesn't update when cell H1 on tab 3 updates. Does the code need to be modified a bit to accomplish this? Thank you in advance.