Whats the different between using these two functions in VBA? Is there a speed advantage of using one over the other?
Application.WorksheetFunction.IsNumber(myVar)
IsNumeric(myVar)
IsNumeric is a VBA standard library function located in the VBA.Information module, like IsArray, IsDate, IsError, Err, VarType, and more:

As part of the VBA standard library, it works regardless of the host application: the standard library is safe to presume as existing on a machine that runs VBA.
Application.WorksheetFunction.IsNumber, on the other hand, is found in the Microsoft Excel object model library:

As such, the code can only work if the Excel type library is referenced. If you're already in Excel, that's not a problem. But if you're in Word and you would like to use a function that returns a Boolean when the given String is numeric, you don't want to reference the whole Excel type library just for that.
The WorksheetFunction interface is a gateway to Excel's calculation engine: with it, you can write VBA code that can now use INDEX/MATCH against carefully crafted plain-VBA arrays - it's completely awesome. But there's no guarantee that Excel's calculation engine works exactly the same way VBA does. If you want to go by Excel's rules, use WorksheetFunction.
I would probably presume VBA.Information.IsNumeric to be faster than Excel.WorksheetFunction.IsNumber though: I could be wrong, but it seems like fewer moving parts are involved with just the VBA standard library.
But the only way to find out:
You have two horses - race them!
;-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With