Disable/Protect Cells based on If

B

bforster1

Is it possible to have code that protects cells based on an i
statement. I have the following code that unhides certain rows if th
user selects "Units" from the ComboBox. I would like other cells to b
protected if the user selects "Units" and then unprotect if no
"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
 
T

Tom Ogilvy

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

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