I found a proposed solution on another forum, but the code does not work for me (I don't see any reaction after I open the workbook...perhaps it needs updating or fixing):
Quote:
Code:
Private Sub Worksheet_Activate()
Dim N As Long, r As Range, rng As Range
Dim d As Date
N = Cells(Rows.Count, "G").End(xlUp).Row
Set rng = Range("G3:G" & N)
For Each r In rng
If IsDate(r.Value) Then
d = r.Value
If d < Date Then
r.Value = DateSerial(Year(d) + 1, Month(d), Day(d))
End If
End If
Next r
End Sub
|
Source:
microsoft excel - How do I add 1 year to a specific date once that date has passed? - Super User
Any ideas on what the problem with that code might be? I did the following:
- Saved my workbook as xlsm
- Hit Alt + 11 and pasted the code
- Changed G3 to G6 to match the first cell of data in my worksheet
- Saved and Reopened the workbook.
- Accepted the "enable content" notification, saved and reopened again, but the old date does not update (I have cell G6 as June 7, 2018, for testing but it does not update).