Display Current Date & Time in a cell: Everytime I open the workbo

S

sam

Hi All,

Is there a way I can display Current Date & Time in a cell which updates
everytime I open the workbook?

Thanks in Advance
 
P

Pete_UK

Put

=NOW()

in a cell, and use a custom format on that cell to show date and time
in the style that you wish.

Hope this helps.

Pete
 
R

Rajesh Mehmi

Hi Sam

=Now() in cell will work, but it will keep updating date & time as the
spreadsheet is recalculated.

The code below will put the date & time in cell A1 on sheet1 and will not
get updated as the spreadsheet is recalculated.

Private Sub Workbook_Open()
Sheets(1).Cells(1, 1).Value = Now()
End Sub

Hope it helps
Best regards
Rajesh Mehmi
(e-mail address removed)
 
S

sam

Thanks for the help Rajesh, However I forgot to mention one thing..
I am going to save this file with value from that cell (date and time
stamp). But I dont want the value in that cell with date and time stamp to
update everytime with current date and time when I open any previous saved
file.
Sorry for the confusion before

Hope I made it clear

THanks in advance
 
R

Rajesh Mehmi

Hi Sam
Try this
This will put the stamp on last unused row.


Private Sub Workbook_Open()
Dim LR As Long
Sheet1.Select
If WorksheetFunction.CountA(Cells) > 0 Then
LR = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
End If
Sheets(1).Cells(LR + 1, 1).Value = Now()
End Sub

Hope it hepls


--
Best regards

Rajesh Mehmi

(e-mail address removed)
 

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