I need to lock columns based on days stated in G8, H8, I8, J8, and K8.
I need to lock G9 through G44 if G8 doesn’t have today's day.
If today is Sunday and G8 has Sunday then G9 to G44 should be open If not then the data range should be locked.
This should be done with all the columns from G to K. How can I do that? Thanks a million in advance.
Private Sub worksheet_Change(ByVal Target As Range) Dim col As Range With ThisWorkbook.Sheets("Sheet1") .Unprotect "ABCDE" For Each col In .UsedRange.Columns col.EntireColumn.Locked = col.Range("A1").Value < Date Next col .Protect "ABCDE" .EnableSelection = xlNoRestrictions End With End Sub
Worksheet_Activate
andWorkbook_Open()
- Czeskleba