Protect the Sheet Name

  • Thread starter Thread starter Buce Roberson
  • Start date Start date
B

Buce Roberson

I am giving my spreadsheets to other users now, and I've
already run into one area that any unknowing user can
screw up a macro unintentionally.

Most of my print routines and other operations select a
sheet by name. But if a user decides to change the name of
a sheet to suit themselves, the sheet references are
fouled up.

How can I set the workbook up to protect the name on the
sheet tab without protecting the sheet itself?

Thanks,


Bruce
 
Bruce,

use the codename.

If you look at the explorer window for a workbook, you will see that each
sheet has two names. The name in brackets is the name that the user sees,
the first name is the codename.

You can change the codename by clicking the sheet in the explorer, and then
modify the name property in the properties window.

You access a sheet like

sheet1.Activate

rather than

Worksheets("Summary").Activate

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Tools -> Protection -> Protect Workbook

This will also prevent the user from deleting or moving
any sheets. This may cause an issue with your program if
your VBA code tries to rename, delete, re-orded,...any of
the sheets. The only way around this that I know of is to
unprotect the workbook in your code just before the
manipulation, and then re-protect it in your code.

thisworkbook.unprotect Password:="123"
' rename sheet
thisworkbook.protect Password:="123"

HTH...

thisworkbook.
 

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