Hi,
I get this message:
"Runtime Error'1004': Method 'range' Of Object'_global'failed "
when I run through the last bit of the code below , which is supposed to merely add a page item to my pivot.
Dim s As Worksheet
Dim p As PivotTable
Dim i As PivotItem
For Each s In Sheets
For Each p In s.PivotTables
Debug.Print "Refreshing Pivottable " & p.Name & " on sheet " & s.Name
p.PivotFields("[Contract Dimension].[Legal Entity]").AddPageItem ( _
"[Contract Dimension].[Legal Entity].&[" & Range("LegalEntity") & "]") ', True
can anyone help,please?
Thanks in advance!
I get this message:
"Runtime Error'1004': Method 'range' Of Object'_global'failed "
when I run through the last bit of the code below , which is supposed to merely add a page item to my pivot.
Dim s As Worksheet
Dim p As PivotTable
Dim i As PivotItem
For Each s In Sheets
For Each p In s.PivotTables
Debug.Print "Refreshing Pivottable " & p.Name & " on sheet " & s.Name
p.PivotFields("[Contract Dimension].[Legal Entity]").AddPageItem ( _
"[Contract Dimension].[Legal Entity].&[" & Range("LegalEntity") & "]") ', True
can anyone help,please?
Thanks in advance!