Hi everyone,
can anyone please help me to correct this Run-Time '13' error? The error message popped up at the highlighted line of code.
Here is the code
Thanks in advance.
can anyone please help me to correct this Run-Time '13' error? The error message popped up at the highlighted line of code.
Here is the code
Rich (BB code):
With ActiveSheet.PivotTables("xLabor").CubeFields("[CSVFolderPivotTable].[FAIN]")
.Orientation = xlRowField
.Position = 1
End With
Worksheets("Reports").Activate
With Worksheets("Reports").PivotTables("xLabor")
Dim MyFilterArray As String
c = 1
For i = 1 To .PivotFields.Count
r = 1
''Cells(r, c) = .PivotFields(i).Name
For x = 1 To .PivotFields(i).PivotItems.Count
If Mid(.PivotFields(i).PivotItems(x).Name, 31, 4) = "[DC-" And Not (Mid(.PivotFields(i).PivotItems(x).Name, 31, 12) = "[DC-PLANNING") Then
MyFilterArray = MyFilterArray & """" & .PivotFields(i).PivotItems(x).Name & """" & ","
End If
r = r + 1
Next
c = c + 1
Next
MyFilterArray = Left(MyFilterArray, Len(MyFilterArray) - 2)
MyFilterArray = Right(MyFilterArray, Len(MyFilterArray) - 1)
End With
ActiveSheet.PivotTables("xLabor").PivotFields("[CSVFolderPivotTable].[FAIN].[FAIN]").VisibleItemsList = Array(MyFilterArray)
Thanks in advance.