VBA time macro running for


Posted by Jack in the UK on February 04, 2002 4:06 PM

Hi guys, any way to say in A1 put a resuklt for time macro running for ???

Cheers guys for amny ideas, i was start macro
A1 = time now start

B1 = time now finish

C1 take =B1-A1 thus time took but better way or is this correct?

Posted by Jacob on February 04, 2002 5:54 PM

Hi

The function you want in VBA is Timer it keeps track of how long excel is running.

Sub MyMacro

Dim StartTime as Double
Dim EndTime as Double

Starttime = Timer

You Code Here

You Code Here

You Code Here


EndTime = timer - starttime

End Sub

Now you can put there values whereever you want

HTH

Jacob

Posted by Guildenstern on February 04, 2002 10:11 PM

Or .....

Dim t As Date
t = Now()
'your code here
MsgBox Format(Now() - t, "hh:mm:ss")

Posted by Jack in the UK on February 05, 2002 1:10 AM

Well cheers guys big help [NT]



Posted by Jack in the UK on February 05, 2002 1:11 AM

Well cheers guys big help [NT]