Sheet Protection

M

Maistrye

I have a macro to automatically protect my sheets. This macro i
designed to only allow the selection of Unlocked Cells.

ActiveSheet.Protect "a"
ActiveSheet.EnableSelection = xlUnlockedCells

It works fine for every sheet I've used it on up until I re-load i
after I've saved it. (Namely, the locked cells can't be selected, bu
the unlocked ones can.)

When I re-open the workbook, the sheet is still protected, but I ca
select Locked Cells and Unlocked Cells. (Only the Unlocked ones can b
editted, of course.)

Does anyone know of a way to fix this? ie. Change my macro so tha
this problem does not occur?

Thanks,
Scot
 
M

Maistrye

I can see that would work, but that's not what I'm looking for. I don't
want to put macros into the workbooks that I'm working on, I'm merely
attempting to mimic the behavior of:

Tools -> Protection -> Protect Sheet ...
--- Unselecting "Select Locked Cells"
--- Selecting "Select Unlocked Cells"

When doing it through the menu, the next time the worksheet is loaded,
the sheet has the same protection as I initially set it up with.

Currently, my macro is sitting in Personal.xls and is attached to a
button on my desktop which I have set up to toggle the protection on my
worksheet.

And no, it is not a requirement for the work I'm doing, just my own
preference for worksheets where Locked Cells are not selectable.

Thanks,
Scott
 
R

Ron de Bruin

Hi Maistrye

Tools -> Protection -> Protect Sheet ...
--- Unselecting "Select Locked Cells"
--- Selecting "Select Unlocked Cells"

Only in Excel 2002 and 2003

This is working for me in 2002-2003

ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.Protect "ron"
 

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