Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Nevyenn
 
Posts: n/a
Default Want to measure macro elapsed time.

I would like to add an elapsed time function to some of my macros to
determine some performance benchmarks for different PCs. One of my macros is
performing a lookup of roughly 10,000 items against a separate sheet
containing 48 columns of data. (I need to do this because our inventory
control system and MRP systems are not being very friendly.) The way that I
am currently accomplishing this takes a significant amount of time, and I'd
like to be able to record the exact time the macro runs.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default Want to measure macro elapsed time.

I've done this by declaring variables Beg and Fin (for Begin and
Finish) as dates; at the beginning of the code enter the line Beg =
Now() and at the end of the code enter Fin = Now(). Elapsed time is
the result of the formula Fin-Beg, which you can display in a message
box or write to a cell.

  #3   Report Post  
Posted to microsoft.public.excel.misc
Nevyenn
 
Posts: n/a
Default Want to measure macro elapsed time.

Thank you for the advice. At first, the time difference was calculated and
displayed in scientific notation, so I wrote the following to format it
properly for the message box display that you suggested:

Beg = Now()
'Code
Fin = Now()
Elapsed = Fin - Beg
Elapsed = Format(Elapsed, "h:mm:ss")
MsgBox ("Elapsed time of the macro:" & Chr(10) & Chr(10) & " " & Elapsed)

Probably not the simplest way to do it, but it's working for me while I
learn how to refine it.


"Dave O" wrote:

I've done this by declaring variables Beg and Fin (for Begin and
Finish) as dates; at the beginning of the code enter the line Beg =
Now() and at the end of the code enter Fin = Now(). Elapsed time is
the result of the formula Fin-Beg, which you can display in a message
box or write to a cell.


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
Calculating elapsed time tele2002 Excel Discussion (Misc queries) 2 December 22nd 05 05:47 PM
Macro to open workbook and copy and paste values in to orig workbo Dena X Excel Worksheet Functions 1 December 15th 05 11:13 PM
macro to time limit workbook ditchy Excel Discussion (Misc queries) 5 April 26th 05 08:43 AM
How can I get elapsed time between AM start/PM stop khacmac Excel Worksheet Functions 1 February 1st 05 11:17 PM
Date and Time Macro m.j.anderson Excel Discussion (Misc queries) 1 December 1st 04 12:35 AM


All times are GMT +1. The time now is 03:21 AM.

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"