Dan
Try this.
Sub aaa()
Dim OutSH As Worksheet
Set OutSH = Sheets("Analysis")
OutSH.Range("A5:L" & WorksheetFunction.Max(5, OutSH.Cells(Rows.Count, 1).End(xlUp).Row)).ClearContents
Sheets("dump").Activate
Range("B:B").AdvancedFilter action:=xlFilterCopy, copytorange:=OutSH.Range("A4"), unique:=True
lastrow = Cells(Rows.Count, 1).End(xlUp).Row
OutSH.Activate
Range("B5").Formula = "=SUMPRODUCT(--(Dump!$B$2:$B$" & lastrow & "=Analysis!$A5),--(Dump!$S$2:$S$" & lastrow & "=Analysis!B$4))"
Range("B5").AutoFill Destination:=Range("B5:H5")
Range("I5").Formula = "=SUMPRODUCT(--(Dump!$B$2:$B$" & lastrow & "=Analysis!$A5),--(Dump!$S$2:$S$" & lastrow & "=""""))"
Range("B5:I5").AutoFill Destination:=Range("B5:I" & Cells(Rows.Count, 1).End(xlUp).Row)
End Sub
I've got absolutely no idea what formulas should go into columns K and L. If you can provide details of what constitute OK and Pending, then I can enhance the program to include those formulas.
rylo
Bookmarks