Application.ConvertFormula (Excel)

Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both.

There is a 255 character limit for the formula.

ConvertFormula (Formula, FromReferenceStyle, ToReferenceStyle, ToAbsolute, RelativeTo)

inputFormula = "=SUM(R10C2:R15C2)" 
MsgBox Application.ConvertFormula( _ 
 formula:=inputFormula, _ 
 fromReferenceStyle:=xlR1C1, _ 


The following arguments are required:

Formula - A string that contains the formula that you want to convert. This must be a valid formula, and it must begin with an equal sign

FromReferenceStyle (XlReferenceStyle) - The reference style of the formula.

Possible Values are xlA1 - Default. Use xlA1 to return an A1-style reference, xlR1C1 - Use xlR1C1 to return an R1C1-style reference.

Optional arguments

The following arguments are optional

ToReferenceStyle - A constant of XlReferenceStyle specifying the reference style that you want returned. If this argument is omitted, the reference style isn't changed; the formula stays in the style specified by FromReferenceStyle

ToAbsolute - A constant of XlReferenceType that specifies the converted reference type. If this argument is omitted, the reference type isn't changed

RelativeTo - A Range object that contains one cell. Relative references relate to this cell

Application.ConvertFormula procedure builder