Evaluate Method

It is possible to access any of the Excel worksheet functions by using the Evaluate method.


The following line however will generate an error ??


The Evaluate Method can be used to calculate worksheet formulas.
The normal syntax is:
There is also a shorthand format, which uses Square brackets in place of the double quotes.
The formula can by any valid formula with or without an equal sign.
The following four lines are all equivalent


These formulas can contain worksheet functions even those available from the WorksheetFunction object or they can be worksheet array formulas.

The advantage of using the Evaluate method is that the string can be created using variables

Dim sCellAddress As String 
sCellAddress = "B4"
Evaluate("=ISBLANK(" & sCellAddress & ")")

In the above example the ISBLANK function is not available from the WorksheetFunction object as VBA has an equivalent function ISEMPTY.

© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext