SUM IN VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
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
 
try this
x=cells(rows.count,"M").end(xlup).row
msgbox application.sum(range("m11:m" & x)
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top