• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Unlock a range based on cell value

dparteka

Member
I could use help with this, I've gotten the CommandButton portion to work but I'm stuck on the unlocking the range part, if someone out there could enlighten me I’d really appreciate it... thank you for looking
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Unlock L5:L6 when N5 = "?" and make commandbutton11 visible when N5 = "!"

Dim KeyCells As Range
Set KeyCells = Sheet1.Range("N5")

If KeyCells.Value = "?" Then
     Range("L5:L6").Locked = False
Else
     Range("L5:L6").Locked = True
End If

If KeyCells.Value = "!" Then
     CommandButton11.Visible = True
Else
     CommandButton11.Visible = False
End If
End Sub
 
dparteka
... if there are 'only' those rows in that Sub
then I would do it another way ... now, there are extra actions.
(I didn't want to change too much Your idea.)
 
Back
Top