Hi,
I want to check the Colum A and Column E value and then collapse the Pivot table based on the values.
I think this where the error comes up. Specially with the variable ff.
I want to check the Colum A and Column E value and then collapse the Pivot table based on the values.
Code:
myfile.Sheets(3).Select
Dim dd As Range
Dim ee As Range
Dim ff As String
For Each ee In myfile.Sheets(3).Range("E1:E20000")
For Each dd In myfile.Sheets(3).Range("A1:A20000")
With ee
If Left(dd.Value, 1) = "F" And ee.Value = "0.00" Or ee.Value = "(0.00)" Then ff = Left(dd.Value, 10)
ActiveSheet.PivotTables(1).PivotFields("Ref 1").PivotItems(ff).ShowDetail = False
End With
Next
Next
I think this where the error comes up. Specially with the variable ff.
Code:
ActiveSheet.PivotTables(1).PivotFields("Ref 1").PivotItems(ff).ShowDetail = False