Name
Application.ConvertFormula(Formula, FromReferenceStyle, [ToReferenceStyle], [ToAbsolute], [RelativeTo])
Synopsis
Converts cell references in a formula between the A1 and R1C1 reference styles, between relative and absolute references, or both.
Argument |
Description |
Settings |
---|---|---|
|
The formula you want to convert. |
Must be a valid formula beginning with an equals sign |
|
The |
|
|
The |
|
|
The converted |
|
|
The cell that references are relative to. Defaults to active cell. |
|
The following code converts a formula to R1C1 style relative to cell A1:
Sub TestConvertFormula( ) Dim str As String str = "=Sum(A1:A20)" Debug.Print Application.ConvertFormula(str, xlA1, xlR1C1, _ xlRelative, [a1]) End Sub
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.