JayJay6
09-21-2011, 04:09 AM
Hi,
Can anyone plaese help me with the syntax:
The script below is part of a larger script (attachment) which filter a pivottable using text cells.
Everything works fine a long as I filter one object (Field)on one cell (rng1). (="VecItems1")
Now I try to add a second criteria (Field2, rng2) (se below), which doesn't make any errors, but it doesn't work either. Therefore:
Does anyone know how to combine "VecItems1" and "VecItems2" ? And the two "Call"-functions following the VecItems statements ?
Thanks
If Not pt Is Nothing Then
pt.ManualUpdate = True
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim Field As PivotField, Field2 As PivotField
Set Field = pt.PivotFields("Region")
Set Field2 = pt.PivotFields("Name")
Field.ClearAllFilters
Field.EnableItemSelection = False
If Range("rng1", "rng2").Text = "(All)" Then
Call ResetAllItems(pt, Range("Region", "Name"))
Else
' vecItems1 = GetItems(Worksheets("Sheet1").Range("A2:A20"), rng1.Text)
vecItems2 = GetItems(Worksheets("Sheet1").Range("A2:A20"), rng2.Text)
' Call SelectPivotItem(Field, vecItems1)
Call SelectPivotItem(Field2, vecItems2)
End If
pt.RefreshTable
End If
Can anyone plaese help me with the syntax:
The script below is part of a larger script (attachment) which filter a pivottable using text cells.
Everything works fine a long as I filter one object (Field)on one cell (rng1). (="VecItems1")
Now I try to add a second criteria (Field2, rng2) (se below), which doesn't make any errors, but it doesn't work either. Therefore:
Does anyone know how to combine "VecItems1" and "VecItems2" ? And the two "Call"-functions following the VecItems statements ?
Thanks
If Not pt Is Nothing Then
pt.ManualUpdate = True
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim Field As PivotField, Field2 As PivotField
Set Field = pt.PivotFields("Region")
Set Field2 = pt.PivotFields("Name")
Field.ClearAllFilters
Field.EnableItemSelection = False
If Range("rng1", "rng2").Text = "(All)" Then
Call ResetAllItems(pt, Range("Region", "Name"))
Else
' vecItems1 = GetItems(Worksheets("Sheet1").Range("A2:A20"), rng1.Text)
vecItems2 = GetItems(Worksheets("Sheet1").Range("A2:A20"), rng2.Text)
' Call SelectPivotItem(Field, vecItems1)
Call SelectPivotItem(Field2, vecItems2)
End If
pt.RefreshTable
End If