Does protecting a workbook shut off VBA code?

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

Guest

At this site, you guys helped me out on some code to automatically name tabs
from an entry on the worksheets. Works great, thanks!

When I protect the workbook, however, the code does not work. Did I do
something wrong, or does this normaly happen?

I have to protect the workbook for various reasons. Actually, that is why I
needed the tabs to be named automatically.

Any insights welcome!
 
When you protect a worksheet/workbook, even VBA becomes limited.

For example, if a sheet is protected and you use VBA to add a row, you'll
get a runtime error.

You need to add code to your VBA routine that will unprotect the sheet, do
its thing, and then protect it again.

Sheets("whateverthename").UnProtect
....
Sheets("whateverthename").Protect

Hope that helps.
 

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