I can successfully name my sheet tab based on a cell reference in the same sheet with the following VBA code:
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
However, I am struggling to change the sheet tab based on a cell reference in the title sheet. I have tried simply replacing the range with the reference from the desired sheet, Range("Keywords!A1"), but this does not seem to work.
Any suggestions to get around this would be hugely appreciated.