Hi, hopefully this will be an easy one for some of you! I've been playing around with it for a while but I'm still stumped.

Sub RemoveRows()
    ActiveSheet.PivotTables("MilestonePivot").PivotCache.Refresh
    
    Dim i As Long, j As Long
    i = Range("az7")
    For j = 1 To i
        Range("Milestone2").Offset(-1, 0).Select
        Selection.EntireRow.Delete
    Next j
    
    Range("A4").Select
End Sub
As you can see, this macro first refreshes the pivot table. I want the macro to then delete the rows that have been eliminated from the pivot table (there is data beneath the pivot table, I want it to move upwards with the pivot table).

The pivot table update works, but the rows for some reason are not deleted. Suggestions?