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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

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