I am working on a project in Excel 2010 that requires me to group values in a generated pivot table. Ultimately, I plan to create a loop that will filter the pivot, dynamically group the results, copy the final table to a new sheet, and then repeat for each item in page filter. I have 99% of the rest of the code figured out, but the section that groups the data keeps kicking out a runtime error. Because the data I am working with is senstive, I have created a hypothetical file and the code is still giving me the runtime error in this simplified file. I feel like it has to be something simple, but I can't find it. Any help is greatly appreciated.
Sub Group()
Dim pt As PivotTable
Dim ptField As PivotField
Dim rPTRange As Range
Set pt = Sheet1.PivotTables("GMPerctTableGen")
Set ptField = pt.RowFields("GMPerct")
Set rPTRange = ptField.DataRange.Cells(1, 1)
rPTRange.Group Start:=True, End:=True, by:=0.8
End Sub
Bookmarks