DecimalPlaces Property

Microsoft Excel Visual Basic

Show All Show All

DecimalPlaces Property

Returns a Long value that represents the number of decimal places to show for the numbers in the ListColumn object. Returns 0 if the ListDataFormat.Type setting is not appropriate for decimal places. Returns xlAutomatic (-4105 decimal) if the Microsoft Windows SharePoint Services site is automatically determining the number of decimal places to show in the SharePoint list. Read-only Long.

expression.DecimalPlaces

expression    Required. An expression that returns a ListDataFormat object.

Remarks

In Excel, you cannot set any of the properties associated with the ListDataFormat object. You can set these properties, however, by modifying the list on the SharePoint site.

Example

The following example returns the setting of the DecimalPlaces property for the third column of a list in Sheet1 of the active workbook.

    Function GetDecimalPlaces() As Long
    Dim wrksht As Worksheet
    Dim objListCol As ListColumn
   
    Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
    Set objListCol = wrksht.ListObjects(1).ListColumns(3)

    GetDecimalPlaces = objListCol.ListDataFormat.DecimalPlaces
End Function