Code:Dim wksTarget As Worksheet Dim rngDate As Range Dim rngData As Range Dim c As Long Dim LastRow As Long Dim LastCol As Long Dim blnUnlockedAllCells As Boolean Const Pwd As String = "pwd" '<< adjust to suit Set wksTarget = ThisWorkbook.Worksheets("Sheet2") '<< adjust to suit If Not blnUnlockedAllCells Then wksTarget.Protect Password:=Pwd, userinterfaceonly:=True wksTarget.Cells.Locked = False blnUnlockedAllCells = True End If Set rngData = wksTarget.Range("B3:L16") '<< adjust to suit. range including the date row For c = 1 To rngData.Rows.Count If CDate(rngData(c, 1)) <= Date - 2 Then On Error Resume Next rngData.Rows(c).SpecialCells(2).Locked = True On Error GoTo 0 End If Next
Bookmarks