Worksheet name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Anybody know some event code I could use to execute should a user try to
change the name of a worksheet? I wrote a macro that won't work if it gets
lost in the workbook (if someone changes the worksheet names) so I want to
somehow protect the current names. I tried worksheet_change, but that only
seems to execute if a cell in the worksheet is changed. Thanks.
 
If you protect the Workbook (structure option as a minimum) then the user
won't be able to rename, delete, add or change the order of sheets.
 
You could also use the code name of the worksheet. It's shown in the
Project Explorer to the left of the tab name (the one displayed on your
worksheet) and in the Name property of the Properties window for the sheet.
Originally both the tab and the code name are the same, e.g., "Sheet1." You
can change the code name in the Name property in the Properties Window. It
doesn't change if users change the tab name. Use the code name like this:

Sheet1.Range("A1") = "test"

For more info see VBA help for "CodeName Property."

hth,

Doug Glancy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top