View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Elapsed time to run code

Otto,

Your Format string is wrong. Change "00:00:00" to "hh:mm:ss".


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Otto Moehrbach" wrote in message
...
Excel 2002, WinXP
I have the following code to give me the elapsed time for a
macro to run.

Time1 = Time
'My code
Time2 = Time
MsgBox Time1 & " " & Time2
MsgBox Format(Time2 - Time1, "00:00:00")

The first MsgBox gives me 2 times that are some 17 seconds
apart. That's accurate.
The second MsgBox shows 00:00:00 no matter what.

What is wrong with the second MsgBox line?

Thanks for all your help. Otto