Getting current time into cell as a static value

  • Thread starter Thread starter wadefleming
  • Start date Start date
W

wadefleming

I want to get the current time into a cell either by clicking in the
cell or clicking a pushbutton.

Kind of like using =NOW() but once the value should not change after it
is initially set.

A bit like using Ctrl-Colon but as the spreadsheet will be run on a PDA
it needs to be activated by clicking in the cell or a pushbutton.

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

OR a sheet event that would place the static time in a cell when a cell is
double-clicked.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As _
Boolean)
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