View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Disable/Protect Cells based on If

sure. In the same code, unprotect the sheet. Toggle the locked property of
the cells, protect the sheet.

--
Regards,
Tom Ogilvy

"bforster1" wrote in message
...

Is it possible to have code that protects cells based on an if
statement. I have the following code that unhides certain rows if the
user selects "Units" from the ComboBox. I would like other cells to be
protected if the user selects "Units" and then unprotect if not
"Units".

Private Sub ComboBox1_Change()
If Worksheets("Sheet1").Range("J18").Value = "Units" Then
Rows("25:28").Select
Selection.EntireRow.Hidden = True
Rows("25:28").Select
Selection.EntireRow.Hidden = False
End If
If Worksheets("Sheet1").Range("J18").Value = "Input" Then
Rows("25:28").Select
Selection.EntireRow.Hidden = True
Rows("25:25").Select
Selection.EntireRow.Hidden = False
Range("B13").Select
End If

Thanks.


--
bforster1
------------------------------------------------------------------------
bforster1's Profile:

http://www.excelforum.com/member.php...o&userid=11771
View this thread: http://www.excelforum.com/showthread...hreadid=264663