SharePointFormula Property

Microsoft Excel Visual Basic

SharePointFormula Property

Returns a String representing the formula a calculated column. The formula is expressed in Excel syntax (US English locale, A1 notation). Read-only String.

expression.SharePointFormula

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

If the ListColumn object does not belong to a list that is linked to a SharePoint site or if it is not a column designated as a calculated column on the SharePoint site, you will get a run-time error.

Example

The following example assumes that you have a list that contains four columns on a worksheet named "Sheet1" that is linked to a SharePoint site. The fourth column is a calculated column.

    Dim wrksht As Worksheet
Dim oListObj As ListObject
Dim strSPFormula As String

Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
Set oListObj = wrksht.ListObjects(1)
strSPFormula = oListObj.ListColumns(4).SharePointFormula
MsgBox (strSPFormula)