In most cases, yes. Excel's worksheet functions are accessed via the WorksheetFunction method of the Application object. For example, you could access the SUM worksheet functions with a statement such as the following:
Ans = Application.WorksheetFunction.Sum(Range("A1:A3"))
This example assigns the sum of the values in A1:A3 (on the active sheet) to the Ans variable.
Generally, if VBA includes an equivalent function, you cannot use Excel's worksheet version. For example, because VBA has a function to compute square roots (Sqr), you cannot use the SQRT worksheet function in your VBA code.
Was this article helpful?