次の方法で共有


PivotField.DataType Property (Excel)

Returns a XlPivotFieldDataType value that represents the type of data in the PivotTable field.

Syntax

expression .DataType

expression A variable that represents a PivotField object.

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

See Also

Concepts

PivotField Object Members

PivotField Object