macca_18380
New Member
- Joined
- May 15, 2024
- Messages
- 22
- Office Version
- 365
Hi All, thank you in advance for your help!
I would like to create a macro which renames a tab based upon the criteria in cell c3, c3 contains text selected via data validation. I have found this macro elsewhere and have entered into VBA for the specific sheet's code for which i'm trying to change the tab name, but when i do so i get a error message that says "compile error: Ambiguous name detected: Worksheet_Change"
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("C3")) Is Nothing Then
ActiveSheet.Name = ActiveSheet.Range("C3")
ElseIf Not Intersect(Target.Dependents, Range("C3")) Then
ActiveSheet.Name = ActiveSheet.Range("C3")
End If
End Sub
Any help on resolving this error would be greatly appreciated.
Best regards
Michael
I would like to create a macro which renames a tab based upon the criteria in cell c3, c3 contains text selected via data validation. I have found this macro elsewhere and have entered into VBA for the specific sheet's code for which i'm trying to change the tab name, but when i do so i get a error message that says "compile error: Ambiguous name detected: Worksheet_Change"
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not Intersect(Target, Range("C3")) Is Nothing Then
ActiveSheet.Name = ActiveSheet.Range("C3")
ElseIf Not Intersect(Target.Dependents, Range("C3")) Then
ActiveSheet.Name = ActiveSheet.Range("C3")
End If
End Sub
Any help on resolving this error would be greatly appreciated.
Best regards
Michael