SUM IN VBA

J

Jeff

hello,

I need help to create a VBA formula that would add all the rows in column
"M" from M11 all the way down until there's an empty row ?
Thanks,
 
D

duane

sub macro()
dim rng as range
Set rng = Range(Cells(11, 13), Cells(11, 13).End(xlDown))
atotal = Application.WorksheetFunction.Sum(rng)
'
' put the total wherver you want it
'
Cells(1, 1).Value = atotal
end su
 
D

Don Guillett

try this
x=cells(rows.count,"M").end(xlup).row
msgbox application.sum(range("m11:m" & x)
 
J

Jason Morin

Sub SumM()
Dim isum As Long
Dim ilastrow As Long
ilastrow = Range("M11").End(xlDown).Row
isum = Application.WorksheetFunction. _
Sum(Range("M11:M" & ilastrow))
MsgBox isum
End Sub
 
Top