Hi everyone,
I have recently started to use VBA so my knowledge is VERY basic. I found online a way to change a tab name based on cell value but it doesn't work straight away because the cell contains a formula (which is just =Sheet1!A3)
I have been trying to add Sub Worksheet_Calculate() to the code I already have but I keep failing.
Could anyone help me please?
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 for this feature." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("A1").Activate
End Sub
Thank you!!
I have recently started to use VBA so my knowledge is VERY basic. I found online a way to change a tab name based on cell value but it doesn't work straight away because the cell contains a formula (which is just =Sheet1!A3)
I have been trying to add Sub Worksheet_Calculate() to the code I already have but I keep failing.
Could anyone help me please?
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 for this feature." & Chr(13) _
& "It appears to contain one or more " & Chr(13) _
& "illegal characters." & Chr(13)
Range("A1").Activate
End Sub
Thank you!!