I
Ian Coates
I have a subroutine (cutdown version below) which should lock and unlock
cells based on a cell content.
Private Sub ComboBox2_Change()
Worksheets(1).Unprotect
Application.ScreenUpdating = False
' ----- 17cm CHECK -----
If Range("w3").Value = 17 Then
Range("e99").Locked = True
Else
Range("e9").Locked = False
Range("h9:i9").Locked = False
Range("k9").Locked = False
Range("m99").Locked = False
End If
Worksheets(1).Protect
Application.ScreenUpdating = True
End Sub
W3 is the linked cell to combobox2.
If w3=17, there appears to be no problem, though the cells are already
locked.
If w3<>17 I get an eror telling me that the Locked property can not be set
on the Range class.
It nust be something straightforward, but I can't see what.
Any ideas?
TIA
Ian
cells based on a cell content.
Private Sub ComboBox2_Change()
Worksheets(1).Unprotect
Application.ScreenUpdating = False
' ----- 17cm CHECK -----
If Range("w3").Value = 17 Then
Range("e99").Locked = True
Else
Range("e9").Locked = False
Range("h9:i9").Locked = False
Range("k9").Locked = False
Range("m99").Locked = False
End If
Worksheets(1).Protect
Application.ScreenUpdating = True
End Sub
W3 is the linked cell to combobox2.
If w3=17, there appears to be no problem, though the cells are already
locked.
If w3<>17 I get an eror telling me that the Locked property can not be set
on the Range class.
It nust be something straightforward, but I can't see what.
Any ideas?
TIA
Ian