View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default How do I sum a column of unknown length using a macro

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

--


Gary


"SandyPaul" wrote in message
...