Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA - Timing A Block Of Lines


Group,
I'm trying to find out how long blocks of code take to execute in
order to balance my program. Below is a sample of programming I'm
using to attempt this. I doesn't seem to work. Any help for a novice
would be awesome.

Dim StartTime As Long
Dim EndTime As Long
Dim TotalTime As Long
...
...
...
...
...
StartTime = Now()
...
...
...
EndTime = Now()
TotalTime = EndTime - StartTime





Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile: http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=488186

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default VBA - Timing A Block Of Lines

ajocius wrote:
Group,
I'm trying to find out how long blocks of code take to execute in
order to balance my program. Below is a sample of programming I'm
using to attempt this. I doesn't seem to work. Any help for a novice
would be awesome.

Dim StartTime As Long
Dim EndTime As Long
Dim TotalTime As Long
..
..
..
..
..
StartTime = Now()
..
..
..
EndTime = Now()
TotalTime = EndTime - StartTime





Tony

------------------------

If you're trying to time a few lines of code, I don't know how you can do it
directly given the vagaries of applications interacting with the operating
system. Even if you could do it, you'd get meaningless numbers all over the map.

What I have done is something similar to what you're trying, but with a For/Next
loop around the code in question to make it execute 1,000 times or a 1,000,000
times or whatever is necessary to make the lines of code take perhaps 30 seconds
to execute.

In that sort of time frame you can either do something like you're trying, or
even just use a stop watch on it.

Good luck...

Bill
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 105
Default VBA - Timing A Block Of Lines

ajocius wrote:
Group,
I'm trying to find out how long blocks of code take to execute in
order to balance my program. Below is a sample of programming I'm
using to attempt this. I doesn't seem to work. Any help for a novice
would be awesome.

Dim StartTime As Long
Dim EndTime As Long
Dim TotalTime As Long
..
..
..
..
..
StartTime = Now()
..
..
..
EndTime = Now()
TotalTime = EndTime - StartTime





Tony



If you're trying to time a few lines of code, I don't know how you can do it
directly given the vagaries of applications interacting with the operating
system. Even if you could do it, you'd get meaningless numbers all over the map.

What I have done is something similar to what you're trying, but with a For/Next
loop around the code in question to make it execute 1,000 times or a 1,000,000
times or whatever is necessary to make the lines of code take perhaps 30 seconds
to execute.

In that sort of time frame you can either do something like you're trying, or
even just use a stop watch on it.

You'll also need to check an empty For/Next loop to see how long that takes and
subtract it from the totals you get.

Good luck...

Bill
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
Advancing Timing lsmft Excel Discussion (Misc queries) 2 April 9th 06 04:04 PM
how do i make text fit into 1 block in 2 or more lines in Excel Siwelile Excel Discussion (Misc queries) 3 February 10th 06 04:06 PM
Timing a macro ducttape Excel Discussion (Misc queries) 2 February 1st 06 10:23 PM
Timing Issue?? Geoff Excel Programming 4 June 29th 05 05:50 PM
VB timing question Pakenn Excel Programming 1 June 14th 04 01:37 PM


All times are GMT +1. The time now is 10:40 AM.

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"