hi,
can you pls give me the VBA Code for diplaying the time taken by a
macro to give the output.
Regards,
Karthik
hi,
can you pls give me the VBA Code for diplaying the time taken by a
macro to give the output.
Regards,
Karthik
One way:
Dim time1 As Double, time2 As Double
time1 = Timer
' <your macro here>
time2 = Timer
MsgBox Format(time2 - time1, "0.00 \s\ec")
In article <[email protected]>,
"Macro man" <[email protected]> wrote:
> hi,
>
> can you pls give me the VBA Code for diplaying the time taken by a
> macro to give the output.
>
> Regards,
>
> Karthik
Depends upon how accurate you want it. If you want it to get an idea of the
performance of one piece of code over another then a very simple method is
to set a timer at the start and then check against it at the end
Dim nTime
Timer = nTime
.... your code
Debug.Print Timer - nTime
run the code a number of times and average teh results.
If you need more accuracy, search for Hi-Res Timer in the excel newsgroups
in Google, http://tinyurl.com/a4dov
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Macro man" <[email protected]> wrote in message
news:[email protected]...
> hi,
>
> can you pls give me the VBA Code for diplaying the time taken by a
> macro to give the output.
>
> Regards,
>
> Karthik
>
Type, should be
nTime = Timer
at start
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Bob Phillips" <[email protected]> wrote in message
news:emK%[email protected]...
> Depends upon how accurate you want it. If you want it to get an idea of
the
> performance of one piece of code over another then a very simple method is
> to set a timer at the start and then check against it at the end
>
> Dim nTime
>
> Timer = nTime
>
> .... your code
>
> Debug.Print Timer - nTime
>
> run the code a number of times and average teh results.
>
> If you need more accuracy, search for Hi-Res Timer in the excel newsgroups
> in Google, http://tinyurl.com/a4dov
>
> --
>
> HTH
>
> RP
> (remove nothere from the email address if mailing direct)
>
>
> "Macro man" <[email protected]> wrote in message
> news:[email protected]...
> > hi,
> >
> > can you pls give me the VBA Code for diplaying the time taken by a
> > macro to give the output.
> >
> > Regards,
> >
> > Karthik
> >
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks