How do I sum a column of unknown length using a macro

G

Gary Keramidas

this would sum everythiing in column B starting in b4

Sub test()
lastrow = Worksheets("Sheet1").Cells(Rows.Count, "B").End(xlUp).Row

Range("B" & lastrow + 1).Formula = "=sum(B4:B" & lastrow & ")"

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

Top