Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ian ian is offline
external usenet poster
 
Posts: 11
Default Using Now with microseconds Excel 2003

I want to use a macro to put in date time in a cell with microseconds.

I've tried Range("a1").Value = Format(Now, " dd-mm-yyyy hh.mm.ss.
000")

which doesn't work for the milliseconds.

If I enter =now() in a cell manually and use custom format dd/mm/yyyy
hh:mm:ss:000 it works.


Any suggestions please?

I want to create a unique date time reference in each row and thought
I'd use a time date function.

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Using Now with microseconds Excel 2003

Dim d As Double
d = Evaluate("Now()")
Range("A1") = d

format A1 in the worksheet or in VBA to match your reqs.
--
Gary''s Student - gsnu200753
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using Now with microseconds Excel 2003

Option Explicit
Sub testme()
With ActiveSheet.Range("A1")
.NumberFormat = "mm/dd/yyyy hh:mm:ss.000"
.Formula = "=now()"
.Value2 = .Value2
End With
End Sub



ian wrote:

I want to use a macro to put in date time in a cell with microseconds.

I've tried Range("a1").Value = Format(Now, " dd-mm-yyyy hh.mm.ss.
000")

which doesn't work for the milliseconds.

If I enter =now() in a cell manually and use custom format dd/mm/yyyy
hh:mm:ss:000 it works.

Any suggestions please?

I want to create a unique date time reference in each row and thought
I'd use a time date function.

Thanks.


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Using Now with microseconds Excel 2003

I want to use a macro to put in date time in a cell with microseconds.

Another option...

Sub Demo()
[A1] = [TEXT(NOW(),"dd-mm-yyyy hh.mm.ss.000")]
End Sub

--
Dana DeLouis


"ian" wrote in message
ups.com...
I want to use a macro to put in date time in a cell with microseconds.

I've tried Range("a1").Value = Format(Now, " dd-mm-yyyy hh.mm.ss.
000")

which doesn't work for the milliseconds.

If I enter =now() in a cell manually and use custom format dd/mm/yyyy
hh:mm:ss:000 it works.


Any suggestions please?

I want to create a unique date time reference in each row and thought
I'd use a time date function.

Thanks.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Using Now with microseconds Excel 2003

Micro or milli ?

Tim

"ian" wrote in message
ups.com...
I want to use a macro to put in date time in a cell with microseconds.

I've tried Range("a1").Value = Format(Now, " dd-mm-yyyy hh.mm.ss.
000")

which doesn't work for the milliseconds.

If I enter =now() in a cell manually and use custom format dd/mm/yyyy
hh:mm:ss:000 it works.


Any suggestions please?

I want to create a unique date time reference in each row and thought
I'd use a time date function.

Thanks.





  #6   Report Post  
Posted to microsoft.public.excel.programming
ian ian is offline
external usenet poster
 
Posts: 11
Default Using Now with microseconds Excel 2003

Thanks

I used Dave's method. The answer is rounded to the nearest 10 milli-
seconds.

Yes Tim, I made a mistake in the question, milli-seconds is fine,

Ian

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
Excel 2007 versus Excel 2003 & Excel 97-2003 fully compatible Bumpersnesty Excel Worksheet Functions 0 April 26th 10 09:44 PM
How do you format time to handle microseconds Bazza[_2_] Charts and Charting in Excel 2 June 24th 08 08:21 AM
Copying Excel 2003 Selection into Outlook 2003 HTML E-Mail Message [email protected] Excel Discussion (Misc queries) 0 July 10th 06 03:07 PM
Word 2003 Find/Change Automation from Excel 2003 crashes Excel 200 Joel Berry Excel Programming 9 March 6th 06 10:20 PM
i need to format a column as microseconds ? how do i do this SMT Excel Discussion (Misc queries) 1 May 26th 05 09:44 AM


All times are GMT +1. The time now is 12:24 PM.

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

About Us

"It's about Microsoft Excel"