View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default application.worksheetfunction

The choice would usually be determined by the type of error trapping you wanted to do.
Application.WorksheetFunction.Match takes about 1/2 the time of Application.Match,
however if you are only calling the function a few times then you couldn't measure
the time difference.
--
Jim Cone
Portland, Oregon USA




"JP Ronse"
wrote in message
Hi Jim,
Tnx for the clarification. Can I conclude that both syntaxes are equal,
except of course from the returned error, but decision depends who the
programmer will handle errors?

Any idea which is the fastest way? AFAIK, calling the application or
accessing objects is slow compared e.g. accessing a memory variable. If you
have a lot of errors to process, the VBA way can be much faster then the
application way or do I see this wrong?
Wkr,
JP


"Jim Cone" wrote in message
...
The type of error returned is different.

"Application" returns a Variant containing an error which allows the use
of IsError...
If IsError(Application.Match...)

"WorksheetFunction" returns a VBA error which requires an error handler...
On Error Resume Next
Application.WorksheetFunction.Match...
If Err.Number < 0 then
--
Jim Cone
Portland, Oregon USA



"JP Ronse"
wrote in message
...
Hi All,
I see that most of the MVP's are using:
x = application.worksheetfunction.<function(arguments)

while

x = application.<function(arguments)
is also working.
Is there a reason to use worksheetfunction, except that the syntax of the
function is given?
Wkr,
JP