View Single Post
 
Old 05-18-2017, 04:40 AM
jeffreybrown jeffreybrown is offline Windows Vista Office 2007
Expert
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

You could add a couple of lines to the code, but you also have to lock the spreadsheet and unlock A1 so the user can select between Yes and No.

The code will take care of locking and unlocking A2 based on the choice in A1, but not locking the spreadsheet.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Application.Intersect(Target, Range("A1")) Is Nothing Then
        If Range("A1").Value = "No" Then
            Range("A2").Value = 0
            Range("A2").Locked = True
        Else
            Range("A2").Value = ""
            Range("A2").Locked = False
        End If
    End If

End Sub
Reply With Quote