I have a spreadsheet I am developing that has 100 columns (320 rows in each column (row 3 through 323) of drop down lists with 2 values each, "Data", and "No Data" are the values. Each column If the user selects "No Data" for any of those cells, I want the adjacent cell to be locked. I have some code that works for an individual cell; but I need a universal macro that will work for any of the 100 x 323 cells. Plus the code I am using seems to take a really long time for what it does. The code I have is
Private Sub worksheet_change(ByVal Target As Excel.Range)
' Locks range if condition is met
If Range("E3").Value = "No Data" Then
ActiveSheet.Unprotect
Range("F3").Select
Selection.Locked = True
Selection.Value = ".N"
ActiveSheet.Protect
Else
ActiveSheet.Unprotect
Range("F3").Select
Selection.Locked = False
Selection.Value = ""
ActiveSheet.Protect
End If
End Sub
Bookmarks