Protect Sheet vs. VBA Code

S

steveski

I have a data entry sheet which has VBA code to automatically place some
formulas in certain cells. I wish to lock certain columns, then protect
the sheet prior to turning it over to a user.

There are some columns which I wish to protect which are also
automatically filled by the VBA code.

With these columns locked, and the sheet protected, I get an error when
the VBA code attempts to fill the cells in these columns.

Is there a way to let VBA perform and still have these columns
protected?

Thanks.
 
N

Norman Harker

Hi Steveski!

Use:

Worksheets("MySheet").UnProtect Password:="mypassword"

Place your code here

Worksheets("MySheet").Protect Password:="mypassword"

--
--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.

(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 

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

Top