Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
gwm gwm is offline
external usenet poster
 
Posts: 3
Default Excel: How to insert current time (static) to the nearest second?

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Excel: How to insert current time (static) to the nearest second?

Try this one-line macro:

Sub time_it()
Selection.Value = Now
End Sub

you can assign a shortcut like CNTRL-e to it.
--
Gary''s Student - gsnu200720


"gwm" wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest second?

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest second?

Note: you can't assign it to CTRL + SHIFT + ;

Gord Dibben MS Excel MVP

On Wed, 09 May 2007 18:31:50 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Excel: How to insert current time (static) to the nearest second?

Option Explicit
Sub Auto_Open()
Application.OnKey "+^:", "'" & ThisWorkbook.Name & "'!Nowtime"
End Sub
Sub Auto_Close()
Application.OnKey "+^:"
End Sub
Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

My version of NowTime looks more like:

Sub NOWTIME()
On Error Resume Next
With Selection
.Value = Now
.NumberFormat = "hh:mm:ss"
End With
If Err.Number < 0 Then
Beep
End If
End Sub

So I can fill multiple cells.

Gord Dibben wrote:

Note: you can't assign it to CTRL + SHIFT + ;

Gord Dibben MS Excel MVP

On Wed, 09 May 2007 18:31:50 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest second?

Thanks Dave

I should know better than to say "you can't"<g


Gord

On Wed, 09 May 2007 21:35:35 -0500, Dave Peterson
wrote:

Option Explicit
Sub Auto_Open()
Application.OnKey "+^:", "'" & ThisWorkbook.Name & "'!Nowtime"
End Sub
Sub Auto_Close()
Application.OnKey "+^:"
End Sub
Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

My version of NowTime looks more like:

Sub NOWTIME()
On Error Resume Next
With Selection
.Value = Now
.NumberFormat = "hh:mm:ss"
End With
If Err.Number < 0 Then
Beep
End If
End Sub

So I can fill multiple cells.

Gord Dibben wrote:

Note: you can't assign it to CTRL + SHIFT + ;

Gord Dibben MS Excel MVP

On Wed, 09 May 2007 18:31:50 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default Excel: How to insert current time (static) to the nearest second?

That phrase scares the heck out of me, too--just based on the followup posts
proving me wrong!

Gord Dibben wrote:

Thanks Dave

I should know better than to say "you can't"<g

Gord

On Wed, 09 May 2007 21:35:35 -0500, Dave Peterson
wrote:

Option Explicit
Sub Auto_Open()
Application.OnKey "+^:", "'" & ThisWorkbook.Name & "'!Nowtime"
End Sub
Sub Auto_Close()
Application.OnKey "+^:"
End Sub
Sub NOWTIME()
ActiveCell.Value = Format(Now(), "h:mm:ss AM/PM")
End Sub

My version of NowTime looks more like:

Sub NOWTIME()
On Error Resume Next
With Selection
.Value = Now
.NumberFormat = "hh:mm:ss"
End With
If Err.Number < 0 Then
Beep
End If
End Sub

So I can fill multiple cells.

Gord Dibben wrote:

Note: you can't assign it to CTRL + SHIFT + ;

Gord Dibben MS Excel MVP

On Wed, 09 May 2007 18:31:50 -0700, Gord Dibben <gorddibbATshawDOTca wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Excel: How to insert current time (static) to the nearest seco

How do you format for a 24 hour clock, so I don't have to use AM/PM?

"Gord Dibben" wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default Excel: How to insert current time (static) to the nearest seco

Hi MarySue

just remove the AM/PM

ActiveCell.Value = Format(Now(), "h:mm:ss")



--
Regards

Roger Govier


"MarySue" wrote in message
...
How do you format for a 24 hour clock, so I don't have to use AM/PM?

"Gord Dibben" wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or
a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm
wrote:

When inserting the current time you press CTRL + SHIFT + ; and it
displays it
in hours and minutes only. By formatting the cell to display
seconds, it will
give 00 seconds rather than more specific time to the nearest
second. Can
this function be adjusted to be more precise and display time to the
nearest
second rather than just the nearest minute? Note: The "=NOW()"
function does
display time to the nearest second, but I cannot use it in this case
because
it is not static (i.e. updates).





  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest seco

ActiveCell.Value = Format(Now(), "hh:mm:ss;@")


Gord

On Thu, 12 Jul 2007 08:16:00 -0700, MarySue
wrote:

How do you format for a 24 hour clock, so I don't have to use AM/PM?

"Gord Dibben" wrote:

That method will give you the static time but only to the minute.

To the second, use this macro and assign it to the shortcut combo or a button.

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



Gord Dibben MS Excel MVP


On Wed, 9 May 2007 12:49:01 -0700, gwm wrote:

When inserting the current time you press CTRL + SHIFT + ; and it displays it
in hours and minutes only. By formatting the cell to display seconds, it will
give 00 seconds rather than more specific time to the nearest second. Can
this function be adjusted to be more precise and display time to the nearest
second rather than just the nearest minute? Note: The "=NOW()" function does
display time to the nearest second, but I cannot use it in this case because
it is not static (i.e. updates).






  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest seco

Roger

That doesn't return 14:23:23

It returns 2:23:23

Need a custom format of "h:mm:ss;@" or "hh:mm:ss;@"


Gord

On Thu, 12 Jul 2007 17:02:20 +0100, "Roger Govier"
wrote:

Hi MarySue

just remove the AM/PM

ActiveCell.Value = Format(Now(), "h:mm:ss")


  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default Excel: How to insert current time (static) to the nearest seco

Hi Gord

in my immediate window
?Format(Now(), "h:mm:ss")
18:53:22

--
Regards

Roger Govier


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Roger

That doesn't return 14:23:23

It returns 2:23:23

Need a custom format of "h:mm:ss;@" or "hh:mm:ss;@"


Gord

On Thu, 12 Jul 2007 17:02:20 +0100, "Roger Govier"
wrote:

Hi MarySue

just remove the AM/PM

ActiveCell.Value = Format(Now(), "h:mm:ss")




  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default Excel: How to insert current time (static) to the nearest seco

Hi Gord

Perhaps it's because you are already in tomorrow!!<bg
Take a look at the date stamp.

--
Regards

Roger Govier


"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
My mistook it seems.

Works fine currently. Did not earlier.

Don't have any idea<g


Gord

On Thu, 12 Jul 2007 18:54:50 +0100, "Roger Govier"
wrote:

Hi Gord

in my immediate window
?Format(Now(), "h:mm:ss")
18:53:22




  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest seco

Awww geez

I was dorking about with my Date settings in control panel to test and forgot to
change back.

I've been posting tomorrow all afternoon.

Fixed now.

Thanks for pointing that out.

It's these new drugs. That's my story and I'm sticking with it<g


Gord

On Thu, 12 Jul 2007 21:12:17 +0100, "Roger Govier"
wrote:

Hi Gord

Perhaps it's because you are already in tomorrow!!<bg
Take a look at the date stamp.


  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Excel: How to insert current time (static) to the nearest seco

My mistook it seems.

Works fine currently. Did not earlier.

Don't have any idea<g


Gord

On Thu, 12 Jul 2007 18:54:50 +0100, "Roger Govier"
wrote:

Hi Gord

in my immediate window
?Format(Now(), "h:mm:ss")
18:53:22


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert static time Maverick Excel Worksheet Functions 5 July 27th 06 07:43 PM
how do I insert the current time (static) and date in a cell? DF Excel Discussion (Misc queries) 5 October 28th 05 05:54 PM
How to enter current static time in Excel in 00:00:00.0 format? Wlumkong Excel Worksheet Functions 3 May 12th 05 03:54 PM
Excel static current date/time problem hpmted Excel Worksheet Functions 1 March 30th 05 09:12 PM
how do i insert the current time into a cell, and show different . Dave Excel Discussion (Misc queries) 1 March 22nd 05 06:57 PM


All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"