Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Below is a sample of my code to remove all (blanks) in a pivot table.
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") .PivotItems("(blank)").Visible = False End With it works fine it there balnks in the pivot table. However, sometimes if the data set does not have any (blank), the macro generates a Run-time 1004 error. (Unable to get the PivotItems Property of the PivotField class) Is there a that i can skip the code if there are no (blank)? I tried If statement but it did not work. Thanks alot people:)- |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Error Resume Next
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") .PivotItems("(blank)").Visible = False End With Bob Umlas Excel MVP "mju" wrote in message ... Below is a sample of my code to remove all (blanks) in a pivot table. With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") .PivotItems("(blank)").Visible = False End With it works fine it there balnks in the pivot table. However, sometimes if the data set does not have any (blank), the macro generates a Run-time 1004 error. (Unable to get the PivotItems Property of the PivotField class) Is there a that i can skip the code if there are no (blank)? I tried If statement but it did not work. Thanks alot people:)- |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks Alot!!!!
"Bob Umlas" wrote: On Error Resume Next With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") .PivotItems("(blank)").Visible = False End With Bob Umlas Excel MVP "mju" wrote in message ... Below is a sample of my code to remove all (blanks) in a pivot table. With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") .PivotItems("(blank)").Visible = False End With it works fine it there balnks in the pivot table. However, sometimes if the data set does not have any (blank), the macro generates a Run-time 1004 error. (Unable to get the PivotItems Property of the PivotField class) Is there a that i can skip the code if there are no (blank)? I tried If statement but it did not work. Thanks alot people:)- |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Sub test() Dim pi As PivotItem With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") For Each pi In .PivotItems If pi.Caption = "(blank)" And pi.Visible = True Then pi.Visible = False Exit For End If Next End With End Sub regards r Il mio ultimo lavoro ... http://excelvba.altervista.org/blog/...ternative.html "mju" wrote: Below is a sample of my code to remove all (blanks) in a pivot table. With ActiveSheet.PivotTables("PivotTable1").PivotFields ("TRAD_PARTNER ") .PivotItems("(blank)").Visible = False End With it works fine it there balnks in the pivot table. However, sometimes if the data set does not have any (blank), the macro generates a Run-time 1004 error. (Unable to get the PivotItems Property of the PivotField class) Is there a that i can skip the code if there are no (blank)? I tried If statement but it did not work. Thanks alot people:)- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
hide or remove filter arrows from protected pivot table | Excel Discussion (Misc queries) | |||
Pivot Table Macro, exclude possible blanks | Excel Programming | |||
Looking to remove pivot fields from pivot table via macro | Excel Programming | |||
Remove Pivot Table Borders with Macro | Excel Programming | |||
Pivot Table Macro (Show Hide) | Excel Programming |