=today() formula at a cell via macro

sujittalukde

Well-known Member
Joined
Jun 2, 2007
Messages
520
Can a macro be provided which will put today's date to a cell on opening a WB? The user can put any other date to that cell but on reopening of the WB todays date should come to that cell? If I use the formula =today(), the problem is that it the user changes the date nad saves the date, then on reopening the file new dte comes in rather than today's date?
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

zzjasonzz

Well-known Member
Joined
Apr 23, 2006
Messages
649
Right click on the sheet tab, and go view code. then on the left under Microsoft Excel Objects there will be ThisWorkbook, double click on it it should bring up a white box/screen then paste this in:

Code:
Private Sub Workbook_Open()
    Range("A1").Formula = "=today()"
End Sub

obviously substitute A1 for the cell you want
 

hsk

Well-known Member
Joined
Oct 19, 2006
Messages
567
Private Sub Workbook_Open()
Range("A1").Value = Date
End Sub
 

Forum statistics

Threads
1,181,647
Messages
5,931,210
Members
436,784
Latest member
amuljono

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
Top