Jun 28 2021 03:31 PM
Jun 29 2021 07:58 AMSolution
Select all cells that the user should be able to edit in principle.
Press Ctrl+1 to activate the Format Cells dialog.
Activate the Protection tab.
Clear the Locked check box.
Press Alt+F11 to activate the Visual Basic Editor.
In the Project Explorer pane on the left, double-click ThisWorkbook under Microsoft Excel Objects.
Copy the following code into the module:
Private Sub Workbook_Open() Dim c As Long Dim m As Long With Worksheets(1) ' or Worksheets("NameOfSheet") .Protect Password:="Secret", UserInterFaceOnly:=True m = .Cells(1, .Columns.Count).End(xlToLeft).Column For c = 2 To m If .Cells(1, c).Value >= Date Then Exit For .Cells(1, c).EntireColumn.Locked = True Next c End With End Sub
Switch back to Excel.
Save the workbook as a macro-enabled workbook (.xlsm).
Make sure that you allow macros when you open it.