_Application.ConvertFormula Method

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

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function ConvertFormula ( _
    Formula As Object, _
    FromReferenceStyle As XlReferenceStyle, _
    ToReferenceStyle As Object, _
    ToAbsolute As Object, _
    RelativeTo As Object _
) As Object
'Usage
Dim instance As _Application
Dim Formula As Object
Dim FromReferenceStyle As XlReferenceStyle
Dim ToReferenceStyle As Object
Dim ToAbsolute As Object
Dim RelativeTo As Object
Dim returnValue As Object

returnValue = instance.ConvertFormula(Formula, _
    FromReferenceStyle, ToReferenceStyle, _
    ToAbsolute, RelativeTo)
Object ConvertFormula(
    Object Formula,
    XlReferenceStyle FromReferenceStyle,
    Object ToReferenceStyle,
    Object ToAbsolute,
    Object RelativeTo
)

Parameters

  • Formula
    Type: System.Object

    Required Object. A String that contains the formula you want to convert. This must be a valid formula, and it must begin with an equal sign.

  • ToReferenceStyle
    Type: System.Object

    Optional XlReferenceStyle. The reference style you want returned. If this argument is omitted, the reference style isn't changed; the formula stays in the style specified by FromReferenceStyle.

    XlReferenceStyle can be one of these XlReferenceStyle constants.

    xlA1

    xlR1C1

  • ToAbsolute
    Type: System.Object

    Optional XlReferenceStyle. Specifies the converted reference type. If this argument is omitted, the reference type isn't changed.

    XlReferenceStyle can be one of these XlReferenceStyle constants:

    xlAbsolute

    xlAbsRowRelColumn

    xlRelRowAbsColumn

    xlRelative

  • RelativeTo
    Type: System.Object

    Optional Object. Optional Variant. A Range object that contains one cell. Relative references relate to this cell.

Return Value

Type: System.Object

See Also

Reference

_Application Interface

_Application Members

Microsoft.Office.Interop.Excel Namespace