PDA

View Full Version : Solved: Cell Protection



chem101
11-22-2010, 09:10 AM
Hello Everyone,

I would like to protect and unprotect cells J28 and J29 based on an items selected from a drop down window in another cell. J28 and J29 share conditional formatting for two items that are selected from the drop down window in the other cell I mentioned. If values other than these two items are selected I would like J28 and J29 to be protected. I'm having trouble placing both items in the code's argument. Here's what I have so far:

If wksEsInput.Range("InputStyle") <> "ABC" Or "DEF" Then

wksEsInput.Unprotect Password:="Jaxx"

wksEsInput.Range("J28:J28").Locked = True
wksEsInput.Protect _
Password:="Jaxx", _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True

End If

If wksEsInput.Range("InputStyle") = "ABC" or "DEF" Then

wksEsInput.Unprotect Password:="Jaxx"

wksEsInput.Range("J28:J28").Locked = False
wksEsInput.Protect _
Password:="Jaxx", _
UserInterfaceOnly:=True, _
AllowFormattingCells:=True

End If

Any help you can provide will be greatly appreciated!!
Thank you!

Bob Phillips
11-22-2010, 09:33 AM
With wksEsInput

.Unprotect Password:="Jaxx"

.Range("J28:J28").Locked = .Range("InputStyle") <> "ABC" And .Range("InputStyle") <> "DEF"

.Protect Password:="Jaxx", UserInterfaceOnly:=True, AllowFormattingCells:=True
End With

chem101
11-22-2010, 02:41 PM
Thank you for your response. This didn't work however.

Thank you again for your help!

Bob Phillips
11-22-2010, 02:46 PM
Explain 'didn't work'.

chem101
11-22-2010, 02:48 PM
didn't unprotect the worksheet, didn't unlock the cells in the range

Thank anyway, I appreciate your time and effort.

Bob Phillips
11-22-2010, 03:07 PM
Post your workbook for us to see. we are working blind.