PaulMental
New Member
- Joined
- Nov 7, 2017
- Messages
- 2
Greetings,
I am having trouble on what should be an easy code.
I get a run-time error 5 invalid procedure call or argument.
I am new to VBA and wondering if I might be missing something. I feel this may be an easy problem to fix. Any help would be appreciated. Thank you.
I am having trouble on what should be an easy code.
Code:
Sub Loop()
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = Sheet9.PivotTables("AC")
Set pf = pt.PageFields("Name")
For Each pi In pf.PivotItems
pf.CurrentPage = pi.Value
Next pi
End Sub
I get a run-time error 5 invalid procedure call or argument.
I am new to VBA and wondering if I might be missing something. I feel this may be an easy problem to fix. Any help would be appreciated. Thank you.