Run Time error 428 Help

currybai

Board Regular
Joined
Jul 14, 2008
Messages
202
I get an error here:

Code:
For Each pi In Worksheets("Pivot").PivotTables("pivottable1").PivotFields("Name of Person")
Please help

Code:
Sub macro_214431()

Dim pt As PivotTables
Dim pi As PivotItems
Dim pf As PivotFields

Worksheets("Pivot").PivotTables("pivottable1").ManualUpdate = True

     With Worksheets("Pivot").PivotTables("pivottable1").PivotFields("name of Person")
         For Each pi In Worksheets("Pivot").PivotTables("pivottable1").PivotFields("Name of Person")
            If pi(i).Visible = True Then
                ActiveSheet.Rows("1:2").Insert Shift:=xlDown
                Cells(1, 1).Value = "Name:" & "," & pi(i)
                Cells(1, 1).FontSize = 13
                Cells(1, 1).Font.Bold = True
                Range("A1:d1").HorizontalAlignment = xlCenterAcrossSelection
                .PrintTitleRows = "$1:$6"
                
                End If

                Next pi

End With
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Please tell us what the error message is and what you are trying to do.:)
 
Upvote 0
Please tell us what the error message is and what you are trying to do.:)


I get a runtime 428 error: Object does not support this property of method

I am trying to take the selected report filter in the Name of Person field to appear as the title ont he first cell in a1. So if someone chooses bob, christina, then their names would appear on top.
 
Upvote 0
I think you might want to lose the ("Name of person") part.

Or add something to it, Pivotfields(Item) returns a PivotField object which has various properties.
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,208
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top