Applies To
Application Object.
Description
Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both.
Syntax
object.ConvertFormula(formula, fromReferenceStyle, toReferenceStyle, toAbsolute, relativeTo)
object
Required. The Application object.
formula
Required. A string containing the formula that you want to convert. This must be a valid formula and it must begin with an equal sign.
fromReferenceStyle
Required. The reference style of the formula. May be either xlA1 or xlR1C1.
toReferenceStyle
Optional. The reference style you want returned. May be either xlA1 or xlR1C1. If omitted, the reference style is not changed (the formula stays in the style specified by fromReferenceStyle).
toAbsolute
Optional. Specifies the converted reference type (one of xlAbsolute, xlAbsRowRelColumn, xlRelRowAbsColumn, or xlRelative). If this argument is omitted, the reference type is not changed.
relativeTo
Optional. A Range object that contains one cell. This object determines the cell to which relative references relate.
Example
This example converts a SUM formula that contains R1C1-style references to an equivalent formula that contains A1-style references and then displays the result.
inputFormula = "=SUM(R10C2:R15C2)" MsgBox Application.ConvertFormula( _ formula:=inputFormula, _ fromReferenceStyle:=xlR1C1, _ toReferenceStyle:=xlA1)