Can't think of any way of doing this that doesn't involve replacing the formulae for days past with a static value.
You could do this using the Workbook_Open() event, Worksheet_Change() event and others, but the workbook would then have to be a macro-enabled one. For example:
Private Sub Workbook_Open()
Dim resp As Variant
resp = MsgBox("Would you like to prevent past data from being changed?", vbYesNo, "Question")
If resp = vbYes Then
With Arkusz1
' first sort so we know things are in chronological order
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add2 Key:=Range("C3:C45"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("B2:E45")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
' loop through the dates until we get to today's date:
For Each d In .Range("C3:C45")
' replace formula with value if earlier than today
If d.Value < Date Then
d.Offset(0, 2).Value = d.Offset(0, 2).Value
Else: Exit For
End If
Next d
End With
End If
End Sub
Would that do the trick?
Tim
Bookmarks