Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how do i add time to see how long my macro takes to run


hi, my macro takes a few hours to run. i would like to add a function
inside to measure the time taken. can anyone share how it's done?
thanks.


--
ernestgoh
------------------------------------------------------------------------
ernestgoh's Profile: http://www.excelforum.com/member.php...o&userid=24870
View this thread: http://www.excelforum.com/showthread...hreadid=561815

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default how do i add time to see how long my macro takes to run

try

Sub test()
x = Now()
'
' ur kode
'
MsgBox ("Minute :") & Minute(Now() - x) & " Second :" & Second(Now() - x)
End Sub




"ernestgoh" skrev:


hi, my macro takes a few hours to run. i would like to add a function
inside to measure the time taken. can anyone share how it's done?
thanks.


--
ernestgoh
------------------------------------------------------------------------
ernestgoh's Profile: http://www.excelforum.com/member.php...o&userid=24870
View this thread: http://www.excelforum.com/showthread...hreadid=561815


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default how do i add time to see how long my macro takes to run

hi,
there are a lot of ways to do this. here's one...

Range("A1").Value = Time
'YourMacro runs here
Range("A2").Value = Time
Range("A3").FormulaR1C1 = "=SUM(R[-1]C-R[-2]C)"
Range("a1:a3").Select
Selection.NumberFormat = "h:mm:ss"

here's another

Dim time1
Dim time2
Dim time3
time1 = Time
'YourMacro runs here
time2 = Time
time3 = time2 - time1
MsgBox time3

regards
FSt1

"ernestgoh" wrote:


hi, my macro takes a few hours to run. i would like to add a function
inside to measure the time taken. can anyone share how it's done?
thanks.


--
ernestgoh
------------------------------------------------------------------------
ernestgoh's Profile: http://www.excelforum.com/member.php...o&userid=24870
View this thread: http://www.excelforum.com/showthread...hreadid=561815


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
Clearing cells takes long, long time unclemuffin Excel Discussion (Misc queries) 9 August 17th 07 02:22 AM
Save takes long time Jan Excel Discussion (Misc queries) 2 February 15th 06 06:01 PM
Time Calculation - How long a macro takes to run cdb Excel Programming 7 March 31st 05 08:51 AM
Saving Takes long time kvenku[_6_] Excel Programming 1 May 14th 04 02:38 PM
deleting rows, takes a long time! Nick Excel Programming 1 July 22nd 03 03:38 AM


All times are GMT +1. The time now is 08:06 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"