Protect Sheet and Lock Cells

D

DB

Hi, is it possible to protect a worksheet so users can
only select unlocked cells in Excel 2000? I have a
worksheet with certain cells protected. Users of the
worksheet can select all of the cells and modify only the
unprotected cells. I want them to only be able to select
(and modify) the unprotected cells. I know how to do it
in Excel 2002, but can't figure it out in Excel 2000.
Thanks for any help.
 
D

Dave Peterson

You could have a macro that does the protecting--put it in your auto_open
or workbook_open event:

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi"
.EnableSelection = xlUnlockedCells
End With
End Sub

Excel won't remember this setting after you close it and reopen the workbook
(that's why it's in auto_open).
 
D

Dave Peterson

You actually have to do each worksheet one at a time. But you could put your
code into a loop and pick them up that way:

Option Explicit
Sub auto_open()
Dim wks As Worksheet
For Each wks In Worksheets(Array("sheet1", "sheet2"))
With wks
.Protect Password:="hi"
.EnableSelection = xlUnlockedCells
End With
Next wks
End Sub
 

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