View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
DG DG is offline
external usenet poster
 
Posts: 46
Default Sum a column of data

Sweet.... Works like a charm.

Thanks

DG

wrote in message
oups.com...
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))