Update cell with new date

whyttedragun

New Member
Joined
Jan 2, 2014
Messages
4
<style></style>I have a cell that has a date in it. I would like that cell to automatically update with a new date once the date in it is reached. Is this possible?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
What would the new date be? How would you calculate what the new date should be?

Probably VBA approach until clarifciation of the above.
 
Last edited:
Upvote 0
<style></style>Specifically, the cell has the next pay date in it. I would like it to update to the next payday, 2 weeks later, on payday.
 
Upvote 0
Put this VBA code in the "ThisWorkbook" VB Module of that particular workbook.
Code:
Private Sub Workbook_Open()

    Dim shName As String
    Dim celAdd As String
    Dim dateDiff As Long


'   ***ENTER SHEET NAME TO APPLY TO***
    shName = "Sheet3"
'   ***ENTER CELL ADDRESS TO APPLY TO***
    celAdd = "A1"


'   Go to sheet
    Sheets(shName).Activate
    
'   Check date in cell
    dateDiff = Date - Range(celAdd)
    Do Until dateDiff < 14
        Range(celAdd) = Range(celAdd) + 14
        dateDiff = Date - Range(celAdd)
    Loop
        
End Sub
Just change the sheet name and cell address variables at the top to match your needs.
 
Upvote 0

Forum statistics

Threads
1,215,193
Messages
6,123,560
Members
449,108
Latest member
rache47

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top