Hi there! I am trying to lock tabs in a workbook that has links to other spreadsheets and macros. I found help at the following link:
How to prevent users changing the Worksheet Name with VBA | Dedicated Excel
However when I use the code given:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If ActiveSheet.Name <> "Data" Then
ActiveSheet.Name = "Data"
End If
End Sub
I get the following error:
Compile error: Expected: Then or GoTo
I am too novice to know what this means or how to fix it. Can you 1) help me fix it, or give me another example of a code that will help me lock down my Spreadsheet names?
Thanks!
How to prevent users changing the Worksheet Name with VBA | Dedicated Excel
However when I use the code given:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If ActiveSheet.Name <> "Data" Then
ActiveSheet.Name = "Data"
End If
End Sub
I get the following error:
Compile error: Expected: Then or GoTo
I am too novice to know what this means or how to fix it. Can you 1) help me fix it, or give me another example of a code that will help me lock down my Spreadsheet names?
Thanks!