PDA

View Full Version : Solved: Is it possible to protect specific cells on the sheets,



Nader
03-24-2008, 06:57 AM
Is it possible to protect specific cells on the sheets, not sheets only specific cells.

U_Shrestha
03-24-2008, 09:20 AM
Check this out:

http://www.mrexcel.com/archive/Formatting/3114.html

Nader
03-24-2008, 12:11 PM
I tried the way that in this link:



- Select All cells on the worksheet (Ctrl-A)
- Go into Format Cells (Ctrl-1)
- Go to the Protection Tab
- Ensure that "Locked" is unticked( not selected)
- Click OK
- Select Collumns A-C (Ctrl-Space) to select a collumn, (Shift-RightArrow) to drag
- Go into Format Cells
- Lock these cells
- OK
- Tools, Protection, Protect Sheet
This will only protect the locked cells



it protected the specific cells, but it canceled the format properties for the unprotect cells. Is there another way to protect and keep the format.

rbrhodes
03-24-2008, 10:04 PM
Hi Nader,

This has been around a while (I wish I knew who wrote it...)

Anyways, I adapted it to check a User entered array of cells and 'protect' only those cells.

There is code in the Sheet module as well as in the standard modules. It's in the Standard module (Module1) that you must enter your cells addresses.

Look in the Sub ''UndoZero" for these lines:



' Enter the addresses of the cells to be 'protected'

' Be sure to format as in example

'//BEGIN USER CHANGE

CellRng = Array("$A$1", "$B$1", "$C$2")

'//END USER CHANGE



and enter your cell addresses as per the example.

Change the two msgboxes to suit. One for the cell protection and a second for erroring out (though I've not seen this code error out ...yet...)

Nader
03-25-2008, 03:32 PM
Thank you for help.