Microsoft Office Tutorials and References
In Depth Information Evaluate method
The optional ToAbsolute parameter specifies the converted reference type and can be one of the
following XlReferenceType constants:
Enum XlReferenceType
xlAbsolute = 1
xlAbsRowRelColumn = 2
xlRelRowAbsColumn = 3
xlRelative = 4
End Enum
If this argument is omitted, the reference type is not changed.
Finally, the optional RelativeTo parameter is a Range object containing a single cell. This cell
is used to determine relative references.; that is, we can think of the formula as being placed in this
cell and so all relative references are with respect to this cell.
To illustrate, consider the following code:
sFormula = "=D2"
Debug.Print Application.ConvertFormula(sFormula, _
xlA1, xlR1C1, xlRelative, Range("C3"))
Debug.Print Application.ConvertFormula(sFormula, _
xlA1, xlR1C1, xlRelRowAbsColumn, Range("C3"))
The second line converts from A1 notation to R1C1 notation, assuming that the formula is in cell
C3. Hence, the output is:
= R[-1]C[1]
since D2 is one column to the right and one row up from cell C3. The third line of code converts
A1 notation to R1C1 notation, but uses an absolute column reference and so produces:
= R[-1]C4
since column 4 is one column to the right of column 3. Evaluate method
This method converts an Excel name to an object or a value. Its syntax is:
(This method also applies to Chart, DialogSheet, and Worksheet objects.)
The Name parameter is the name of the object. It can be any of the following types of name:
An A1-style reference
Name can be any A1-style reference to a single cell. The reference is considered to be
absolute. To illustrate, consider the following code, each line of which purports to place
the word Mary in cell A1:
Range("A1").Value = "Mary"
A1.Value = "Mary"
Evaluate("A1").Value = "Mary"
Search JabSto ::

Custom Search