How do I automaticly insert the time with seconds

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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??
 
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
 
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
 

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

Back
Top