automatically enter today's date as a static entry in Excel

T

TJ

Good day,

I have a spreadsheet where when this is opened I would like the time/date it
was opened to be static so I can know when the last changes were made.

I have created a macro button for paste special but is there away to do this
without clicking somewhere meaning as soon as the file is opened the time
/date gets stamped in a particulr cell without hitting save?

Appreciate anyone's help on this

thanks
TJ
 
B

Bob Phillips

Private Sub Workbook_Open()

Worksheets("Sheet1").Range("A1").Value = Now
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code
 
F

FSt1

hi
you could use the workbook open event to put the date/time in any cell you
want. which cells on what sheet would be the target cells.
Private Sub Workbook_Open()
Sheets("sheet1").Range("A1").Value = Date
Sheets("sheet1").Range("B1").Value = Time
'or
'Sheets("sheet1").Range("A1").Value = Now()

regards
FSt1
End Sub
 
J

John C

Word of advice. You don't want this event to occur when opening. If you do,
then every time you open the file, it will display the time that it is
opened, not the time that changes were last made, as you said you wanted. You
want the time stamp to occur when the file is saved.

but that is just my 2 cents.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top