title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
CalculatedMembers.Item property (Excel) |
vbaxl10.chm684074 |
|
|
82ba55c7-0c16-df11-ac32-40868f57d2e1 |
04/13/2019 |
medium |
Returns a single object from a collection.
expression.Item (Index)
expression A variable that represents a CalculatedMembers object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Index | Required | Variant | The name or index number of the object. |
The following example notifies the user if the calculated member is valid or not. This example assumes that a PivotTable exists on the active worksheet that contains either a valid or invalid calculated member.
Sub CheckValidity()
Dim pvtTable As PivotTable
Dim pvtCache As PivotCache
Set pvtTable = ActiveSheet.PivotTables(1)
Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1)
' Handle run-time error if external source is not an OLEDB data source.
On Error GoTo Not_OLEDB
' Check connection setting and make connection if necessary.
If pvtCache.IsConnected = False Then
pvtCache.MakeConnection
End If
' Check if calculated member is valid.
If pvtTable.CalculatedMembers.Item(1).IsValid = True Then
MsgBox "The calculated member is valid."
Else
MsgBox "The calculated member is not valid."
End If
Not_OLEDB:
MsgBox "The source is not an OLEDB data source."
Exit Sub
End Sub
[!includeSupport and feedback]