VBA Tip: Prevent the Name of a Sheet From Being Changed
If edits to the name of an Excel worksheet could cause an error, it might be a good idea to prevent this from happening.
One simple way to do this would be to enter the following code on the worksheet in question, replacing Example with the name of the sheet:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveSheet.Name <> "Example" Then ActiveSheet.Name = "Example" End If End Sub
Each time the selection changes, the name of the sheet will be verified and changed, if necessary.