Include the following Event Macro in the worksheet code area:
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))
Each time the worksheet is activated, the macro will scan all the dates in column G start from G3. If the date is "stale", the date is advanced by one year.
Because it is worksheet code, it is very easy to install and automatic to use:
- right-click the tab name near the bottom of the Excel window
- select View Code - this brings up a VBE window
- paste the stuff in and close the VBE window
If you have any concerns, first try it on a trial worksheet.
If you save the workbook, the macro will be saved with it.
If you are using a version of Excel later then 2003, you must save
the file as .xlsm rather than .xlsx
To remove the macro:
- bring up the VBE windows as above
- clear the code out
- close the VBE window
To learn more about macros in general, see:
To learn more about Event Macros (worksheet code), see:
Macros must be enabled for this to work!