Name

listcolumn.SharePointFormula

Synopsis

For shared lists, returns a string representation of the formula that SharePoint uses to calculate a column. If the column is not calculated by SharePoint, returns an empty string. The following code displays the formula for calculated columns in a list:

Sub ShowForumulas(  )
    Dim ws As Worksheet, lst As ListObject, col As ListColumn
    Set ws = ActiveSheet
    Set lst = ws.ListObjects("Test List")
    For Each col In lst.ListColumns
        If col.SharePointFormula <> "" Then
            MsgBox "Column: " & col.Name & _
              " Formula: " & col.SharePointFormula
        End If
    Next
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.