DataType Property

Applies To

PivotField Object.

Description

Returns a constant describing the type of data in the pivot field. Can be xlText, xlNumber, or xlDate. Read-only.

Example

This example displays the data type of the field named "ORDER_DATE."


Set pvtTable = Worksheets("Sheet1").Range("A3").PivotTable
Select Case pvtTable.PivotFields("ORDER_DATE").DataType
    Case Is = xlText
        MsgBox "The field contains text data"
    Case Is = xlNumber
        MsgBox "The field contains numeric data"
    Case Is = xlDate
        MsgBox "The field contains date data"
End Select