View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] stjori@hotmail.com is offline
external usenet poster
 
Posts: 11
Default Sum a column of data

On Oct 5, 6:37 pm, "DG" wrote:
How do I sum a column of data in a macro?

Assume I have a worksheet and cells C1 through C20 have numbers. How can I
get the sum of those numbers without a loop?

I tried
Total = Sum(Range("C1").End(xlDown))

But got an error that Sum is not defined as a funtion.

DG


Try
Total=WorksheetFunction.Sum(Range("C1",Range("C1") .End(xlDown))