PDA

Click to See Complete Forum and Search --> : Excel Macro error


Abie_Martin
Jan 25th, 2000, 05:41 PM
Hi All,

We bumped into the following problem in an excel workbook:

brand qtr value Sum of value qtr
ps q1 5 brand q1 q2
ps q2 4 ps 5 4
ps xm q1 3 ps xm 3 3
ps xm q2 3
The following macro produce an error '1004'
Application-defined or object defined error and it looks as if "ps <anything>" causes the error.

Sub test()
Dim p As PivotTable
Dim b As Range

Set p = ActiveSheet.PivotTables("pivottable1")
p.PivotSelect "brand[all]", xlLabelOnly
Set b = Selection

For i = 1 To 2
p.PivotSelect b.Cells(i).Value, xlDataOnly
Next i

End Sub

Please help.
Abie_Martin@britamtob.com