Skip to content

Latest commit

 

History

History
61 lines (38 loc) · 2.11 KB

Excel.Application.ConvertFormula.md

File metadata and controls

61 lines (38 loc) · 2.11 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Application.ConvertFormula method (Excel)
vbaxl10.chm133097
vbaxl10.chm133097
Excel.Application.ConvertFormula
6ed0a76c-9db5-f6ab-a91d-d4e1b6674c53
04/04/2019
medium

Application.ConvertFormula method (Excel)

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

Syntax

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

expression A variable that represents an Application object.

Parameters

Name Required/Optional Data type Description
Formula Required Variant 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 Required XlReferenceStyle The reference style of the formula.
ToReferenceStyle Optional Variant 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 Optional Variant A constant of XlReferenceType that specifies the converted reference type. If this argument is omitted, the reference type isn't changed.
RelativeTo Optional Variant A Range object that contains one cell. Relative references relate to this cell.

Return value

Variant

Remarks

There is a 255 character limit for the formula.

Example

This example converts a SUM formula that contains R1C1-style references to an equivalent formula that contains A1-style references, and then it displays the result.

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

[!includeSupport and feedback]