I have a pivot table that uses data from a different sheet.
The number of rows and columns changes from run to run.
I want to update the source the pivot table uses.
Here is the code I am trying to use below. I get the run time error 1004 on the highlighted line.
Suggestions?
Thanks.
Sub Refresh_Results_Pivot()
Dim Source As Range
Sheets("Combined").Select
Range("A1").Select
Selection.CurrentRegion.Select
Set Source = Selection
Sheets("Results").Select
With ActiveSheet.PivotTables("Results_Pivot").PivotCache
.SourceData = Sheets("Combined").Range(Source).Address(True, True)
End With
End Sub
Bookmarks