Thread
:
Sum formula in macro returns zero
View Single Post
#
2
Posted to microsoft.public.excel.programming
Papou
external usenet poster
Posts: 67
Sum formula in macro returns zero
Hello
Your syntax works for me (Excel 2003) if I use this:
Dim MarketCount&
MarketCount = Range("Q65536").End(xlUp).Row
Rng4.Value = Application.Sum(Range("Q8:Q" & MarketCount))
Maybe your variable marketCount is the problem?
HTH
Cordially
Pascal
"DanSmoach" a écrit dans le message de
news:
...
Hi
Does anyone have any suggestions on what can be causing this problem?
As part of a larger macro that formats a report, I need to include the sum
of a range eg Q8:Q25. At the time of running the macro the number of rows
to
sum is not known (ie in this case 25), but is captured by the variable
marketCount. The variable marketCount is placed in another cell of the
report
and is working correctly.
The following line returns 0
rng4.Value = Application.Sum(Range("Q8:Q" & marketCount))
The values in column Q are formatted as $. When I manually write a sum
formula (ie. =Sum(Q8:Q25)) the correct result is obtained.
Does anyone know what is causing this problem or can suggest alternate
code
to sum these values - it is driving me crazy.
Thanks for your consideration of this issue.
Reply With Quote
Papou
View Public Profile
Find all posts by Papou