Hello everyone, it's my first post here.
This is Excel 2007.
I'm operating on a quite big database in Excel, 250 k rows. From these data, with VBA I create a pivot table.
Then I am trying to show only several items from one column, for example the column is "Country". Then I have a lot of different countries (items) there, maybe around 100-150.
I don't have a problem if I try show only one item, then I'm using:
But the problem appears when there is a need to show more than one, because then the loop is needed. And it takes a very long time to proceed, It seems like thinking and thinking, 10 minutes is not enough. When I stop and debug, the yellow line is "End If".
The code I'm using to select the chosen countries:
As advised, I was also trying this, but didn't help:
Is there any way to make it faster? I will really appreciate any help. Thank you very much. Best regards.
PS: I'm a beginner.
This is Excel 2007.
I'm operating on a quite big database in Excel, 250 k rows. From these data, with VBA I create a pivot table.
Then I am trying to show only several items from one column, for example the column is "Country". Then I have a lot of different countries (items) there, maybe around 100-150.
I don't have a problem if I try show only one item, then I'm using:
Code:
pvt.PivotFields("op_kr_wys").PivotFilters.Add Type:=xlCaptionContains, Value1:="China"
But the problem appears when there is a need to show more than one, because then the loop is needed. And it takes a very long time to proceed, It seems like thinking and thinking, 10 minutes is not enough. When I stop and debug, the yellow line is "End If".
The code I'm using to select the chosen countries:
Code:
For Each pivotIt In pvt.PivotFields("op_kr_wys").PivotItems
If pivotIt.Name <> "Chiny" And pivotIt.Name <> "Rosja" Then
pivotIt.Visible = False
End If
Next pivotIt
As advised, I was also trying this, but didn't help:
Code:
Application.EnableEvents = False
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Is there any way to make it faster? I will really appreciate any help. Thank you very much. Best regards.
PS: I'm a beginner.