Hello, everyone
I am trying to make a macro that, if cells A36, A37 and A38 contain the numbers 1 to 3, lock the adjacent cell B36 or B37 or B38 or all cells depending on whether they contain the numbers 1 to 3.
I've tried quite a bit of searching on the internet and trying to help myself, but I can't get the macro I'm uploading.
I am asking for some help from you.
Thanks in advance to each one!
'
Private Sub Worksheet_Change(ByVal Target As Range)
Sub tedsst()
Application.ScreenUpdating = False
ThisWorkbook.Worksheets("bANANAS").Unprotect ("k0st4d")
'ActiveSheet.Unprotect Password:="123" '->>> How to say witch Sheet name i.e "Banana"
If Range("A36") = ">=3" Then
Range("B36").Locked = False
ElseIf Range("A36") = "<3" Then
Range("B36").Locked = True
End If
If Range("A37") = ">=3" Then
Range("B37").Locked = False
ElseIf Range("A37") = "<3" Then
Range("B37").Locked = True
End If
If Range("A38") = ">=3" Then
Range("B38").Locked = False
ElseIf Range("A38") = "<3" Then
Range("B38").Locked = True
End If
ActiveSheet.Protect Password:="123"
ThisWorkbook.Worksheets("bANANAS").Protect ("k0st4d")
Application.ScreenUpdating = True
End Sub