Hi experts, I am bit new to VBA macros .
I have made one daily attendance sheet, where in entered value to be locked once current date is passed. Values are getting selected from drop down.
code i have used
Private Sub worksheet_Change(ByVal Target As Range)
Dim col As Range
With ThisWorkbook.Sheets("Sheet1")
.Unprotect "123"
For Each col In .UsedRange.Columns
col.EntireColumn.Locked = col.Range("C7").Value < Date
Next col
.Protect "123"
.EnableSelection = xlNoRestrictions
End With
End Sub
My requirement- user will select status on daily basis and once day is over user wont be able to change entered status.
I have made one daily attendance sheet, where in entered value to be locked once current date is passed. Values are getting selected from drop down.
code i have used
Private Sub worksheet_Change(ByVal Target As Range)
Dim col As Range
With ThisWorkbook.Sheets("Sheet1")
.Unprotect "123"
For Each col In .UsedRange.Columns
col.EntireColumn.Locked = col.Range("C7").Value < Date
Next col
.Protect "123"
.EnableSelection = xlNoRestrictions
End With
End Sub
My requirement- user will select status on daily basis and once day is over user wont be able to change entered status.