ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I automaticly insert the time with seconds (https://www.excelbanter.com/excel-discussion-misc-queries/30570-how-do-i-automaticly-insert-time-seconds.html)

AussieAVguy

How do I automaticly insert the time with seconds
 
I need to be able to have excel insert the current time including seconds
into a cell. I've tried the Now() function but it keeps updating everytime
the spreadsheet recalculates. The shortcut ctrl+shift+; doesn't give seconds
and I'd prefer it to happen automaticly.

Anyone??

Gary's Student

You are half way there. Use the NOW() function and afterwards copy the cell
and paste it Value onto itself. This converts the function into a fixed value
--
Gary's Student


"AussieAVguy" wrote:

I need to be able to have excel insert the current time including seconds
into a cell. I've tried the Now() function but it keeps updating everytime
the spreadsheet recalculates. The shortcut ctrl+shift+; doesn't give seconds
and I'd prefer it to happen automaticly.

Anyone??


Gord Dibben

Aussie

Automatically when you select a particular cell would require event code like
this....

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Address = "$B$3" Then
Target.Value = Format(Now(), "h:mm:ss AM/PM")
End If
enditall:
Application.EnableEvents = True
End Sub

To insert the time in the active cell use this macro assigned to a button.

Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub


Gord Dibben Excel MVP

On Tue, 14 Jun 2005 01:09:01 -0700, "AussieAVguy"
wrote:

I need to be able to have excel insert the current time including seconds
into a cell. I've tried the Now() function but it keeps updating everytime
the spreadsheet recalculates. The shortcut ctrl+shift+; doesn't give seconds
and I'd prefer it to happen automaticly.

Anyone??




All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com