Hello,

I am trying to create an excel file that filters pivot table based on a list of names and then emails this view to the person. The macro works perfectly but when I try to save the spreadsheet it crashes, shuts down and does not recover. The code I have used is below (I've taken out the email bit ) and the list of names sits in the sheet called Filter.

Sub RefreshPivot()

LastBDM = Sheets("Filter").Range("B" & Rows.Count).End(xlUp).Row

For Row = 3 To LastBDM

Dim BDM As String
Dim BDMEmail As String
BDM = Sheets("Filter").Range("A" & Row).Value
BDMEmail = Sheets("Filter").Range("B" & Row).Value


Sheets("Filter").Range("B1").Value = BDM
Sheets("RandM").Activate

Sheets("RandM").PivotTables("RandM").PivotCache.Refresh

ActiveWorkbook.Save

Next Row

End Sub