A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Try it like this: Replace "Data Sheet" with the name of the tab with your data set, and update Table1 to the actual table name. If you are not using an Excel Table, convert the range to a table.
Option Explicit
Sub TestMacro()
Dim R As Range
Dim C As Range
Dim i As Long
With Worksheets("Data Sheet").Range("Table1[Retailer Name]")
.Copy .Cells(.Cells.Count).Offset(3)
Set R = .Cells(.Cells.Count).Offset(3).CurrentRegion
R.RemoveDuplicates Columns:=1, Header:=xlNo
Set R = .Cells(.Cells.Count).Offset(3).CurrentRegion
End With
i = 2
For Each C In R
With Sheets("pivot")
With .PivotTables("PivotTable1").PivotFields("Retailer Name")
.ClearAllFilters
.CurrentPage = C.Value
End With
Sheets("fbp").Cells(1, i).Value = .Range("B2").Value
.Range(.Range("E5"), .Cells(.Rows.Count, "E").End(xlUp)).Copy
Sheets("fbp").Cells(3, i).PasteSpecial xlPasteValues
i = i + 1
End With
Next C
R.Clear
End Sub