Thread: Sumif Macro
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rick is offline
external usenet poster
 
Posts: 334
Default Sumif Macro

I love this thanks.

"marcus" wrote:

Hi Rick

This should do the trick.

Regards

Marcus

Sub CreateSum()

Dim Lw As Integer, Sr As Integer

Lw = Range("G" & Rows.Count).End(xlUp).Row + 2
Sr = Lw - 1 'for the Sum row
Range("H" & Lw).Value = "=Sumif(F2:F" & Sr & ",40,H2:H" & Sr &
")"
Lw = Lw + 1
Range("H" & Lw).Value = "=Sumif(F2:F" & Sr & ",50,H2:H" & Sr &
")"

End Sub