Forum Discussion

bkofsky's avatar
bkofsky
Copper Contributor
Oct 28, 2022

I'm trying to reset the value of a cell on the same day every year.

I'm creating a spreadsheet and need to have the value reset to 15 every Oct 1. All I've been able to find so far is increasing values, but nothing as to what I'm trying to do. Any help is appreciated. 

  • bkofsky 

    Create the following code in the ThisWorkbook module in the Visual Basic Editor.

    After that, switch back to Excel and save the workbook as a macro-enabled workbook (*.xlsm).

    Users will have to allow macros when they open the workbook.

    Private Sub Workbook_Open()
        If Month(Date) = 10 And Day(Date) = 1 Then
            Worksheets("Sheet1").Range("A2").Value = 15
        End If
    End Sub

    Change Sheet1 to the name of the sheet and A2 to the address of the cell you want to reset.

Resources