PDA

View Full Version : Solved: locking a worksheet



rodney_malod
01-26-2006, 08:43 AM
how do i lock a worksheet so only one cell can be selected and editted?

i've done the protection thing, but don't want any cells bar one to be available for user selection.

cheers

Marcster
01-26-2006, 09:06 AM
Excel 2000:
To enable any cell to be edited while the sheet is protected:
In this example A1 will be the only cell allowed to be edited

Right-click on cell A1
Format cells...
On the Protection tab untick Locked
OK
Tools > Protection > Protect sheet

VBA:
Range("A1").Select
Selection.Locked = False

HTH

Marcster.

Ken Puls
01-26-2006, 09:27 AM
Hi there,

What version of Excel are you running? If I recall correctly, in 2002 (XP) a feature was addded so that when you asked to protect the sheet, you could check off what you wanted selected. You'd need to uncheck "Select Locked Cells" in that list.

The other option would be to go into the VBE, find the sheet (CTRL R to get the explorer), look at the properties of the sheet (F4 if not already showing), and change the EnableSelection property to "1 - xlUnlockedCells". This method was available as far back as Excel 97.

If you prefer to just do it with code then:
ActiveSheet.EnableSelection = xlUnlockedCells

HTH,

rodney_malod
01-26-2006, 10:02 AM
thanks guys!