This topic has not yet been rated - Rate this topic

CalculatedMember.IsValid Property (Excel)

Published: July 16, 2012

Returns a Boolean that indicates whether the specified calculated member has been successfully instantiated with the OLAP provider during the current session.

expression .IsValid

expression A variable that represents a CalculatedMember object.

This property returns True even if the PivotTable is not connected to its data source. Make sure that the PivotTable is connected before querying the value of the IsValid property.

This example notifies the user about whether the calculated member is valid or not. It assumes a PivotTable exists on the active worksheet.

Sub CheckValidity() 
 
 Dim pvtTable As PivotTable 
 Dim pvtCache As PivotCache 
 
 Set pvtTable = ActiveSheet.PivotTables(1) 
 Set pvtCache = Application.ActiveWorkbook.PivotCaches.Item(1) 
 
 ' Make connection for PivotTable before testing IsValid property. 
 pvtCache.MakeConnection 
 
 ' 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 
 
End Sub

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.