Hello!
I have a sheet where columns A and B have only contain dates and then in T1 I have the actual date with formula =NOW()
With the attached code, it locks all the cells if the date contained in cell B is older than the actual date. The code works good, but I would like to add another condition... In addition to what is doing the macro.. I would like to also lock always columns A and B under the same password shown below "123" no matter what is the actual date.
Can somebody help me with this please?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("B" & Selection.Row).value < Range("T1").value Then
ActiveSheet.Protect Password:="123"
MsgBox "Només es poden modificar les files del torn actual!!!", vbInformation, "Projecte Ebike"
ElseIf Range("B" & Selection.Row).value > Range("T1").value Then
ActiveSheet.Unprotect Password:="123"
ActiveSheet.EnableSelection = xlNoRestrictions
End If
End Sub
Bookmarks