Protect object vs. Protection from menu

N

newbie

Hello all,
When protecting a worksheet from Excel's [Tools =>
Protection] menu I have the option of selecting
the "Select locked cells" & "Select unlocked cells"
checkboxes. However, the protect object in VBA doesn't
seem to provide this functionality, (it only provides the
parameters for the other items in the dialog box). Could
someone tell me how this same functionality is achieved
through VBA? I am looking to create a completely read-
only sheet which can be changed and re-formatted from
another sheet. I am currently unprotecting the sheet,
making my formatting changes, and then re-protecting the
sheet. If I protect the sheet from the menu and un-select
the first two boxes, I acheive the desired result. But
If I protect from VBA I can still select the cell on the
protected sheet, (but obviously I can't change them).
Any help anyone can provide would be extremely
appreciated.
Thank you.
 
W

William

Hi

Try unprotecting the worksheet and then experiment with each of the 3
alternatives below prior to reprotecting the sheet....

ActiveSheet.EnableSelection = xlNoRestrictions
ActiveSheet.EnableSelection = xlUnlockedCells
ActiveSheet.EnableSelection = xlNoSelection

--
XL2002
Regards

William

(e-mail address removed)

| Hello all,
| When protecting a worksheet from Excel's [Tools =>
| Protection] menu I have the option of selecting
| the "Select locked cells" & "Select unlocked cells"
| checkboxes. However, the protect object in VBA doesn't
| seem to provide this functionality, (it only provides the
| parameters for the other items in the dialog box). Could
| someone tell me how this same functionality is achieved
| through VBA? I am looking to create a completely read-
| only sheet which can be changed and re-formatted from
| another sheet. I am currently unprotecting the sheet,
| making my formatting changes, and then re-protecting the
| sheet. If I protect the sheet from the menu and un-select
| the first two boxes, I acheive the desired result. But
| If I protect from VBA I can still select the cell on the
| protected sheet, (but obviously I can't change them).
| Any help anyone can provide would be extremely
| appreciated.
| Thank you.
 

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