+ Reply to Thread
Results 1 to 5 of 5

Measure time between two points in a script

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Measure time between two points in a script

    I'm working on speeding up a very long and complex script, and I wanted to be able to benchmark improvements I make to it, as well as how fast it runs on various machines.

    What script can I use to measure two points in time?

    I am assuming I would do something like

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Measure time between two points in a script

    Try something like this...

    Please Login or Register  to view this content.
    Timer function
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    298

    Re: Measure time between two points in a script

    It gives me readings of about 42,000 seconds for tasks that took less than a minute. are seconds the wrong unit to be measuring? What is the actual unit it's outputing in? IF I know that I Can convert it.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Measure time between two points in a script

    Quote Originally Posted by ks100 View Post
    It gives me readings of about 42,000 seconds for tasks that took less than a minute. are seconds the wrong unit to be measuring? What is the actual unit it's outputing in? IF I know that I Can convert it.
    The time unit is seconds. I don't now what the problem is without seeing how you implemented it.

    This test should show about 5 seconds in the message box.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Measure time between two points in a script

    You may need to use DoEvents() in your routine.

    Here is an API timer and two examples using the Timer routine in Excel similar to AlphaFrog's routine. You will need to add the class if you want to try that method.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. DAX Measure: Grouping time
    By igoodable in forum Excel General
    Replies: 0
    Last Post: 03-18-2015, 03:05 PM
  2. calculating total time worked to measure SLA
    By billsoule in forum Excel General
    Replies: 4
    Last Post: 12-01-2010, 05:49 PM
  3. How to measure the time a function execute
    By nguyennb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2009, 06:58 AM
  4. [SOLVED] Want to measure macro elapsed time.
    By Nevyenn in forum Excel General
    Replies: 2
    Last Post: 05-17-2006, 12:20 PM
  5. [SOLVED] Proc to measure time intervals
    By Neal Zimm in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-28-2006, 08:15 AM
  6. [SOLVED] I need to measure hours between two events(time/date) to give me .
    By iartis in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-11-2005, 10:06 PM
  7. Measure time spent
    By bill_s1416 in forum Excel General
    Replies: 0
    Last Post: 03-04-2005, 12:36 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1