ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do you SUM in VBA code (https://www.excelbanter.com/excel-programming/277040-how-do-you-sum-vba-code.html)

Barmaley

how do you SUM in VBA code
 
this statement
Fore = ForecastV + sum(actl(1):actl(10))

has problem with ":"
I must be missing very simple but cannot see it today

Can you help me

Thanks




Chip Pearson

how do you SUM in VBA code
 
Try something like

Fore = ForecastV + Application.Sum(Range(Act(1), Act(10)))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Barmaley" wrote in message
...
this statement
Fore = ForecastV + sum(actl(1):actl(10))

has problem with ":"
I must be missing very simple but cannot see it today

Can you help me

Thanks






Barmaley

how do you SUM in VBA code
 
that didn't work, but I did work around that works. I didn't have much time
to fool around with sintax.
But I always appretiate help from this newsgroup

s_act = 0
s_for = 0
For rr = 1 To 18
s_act = s_act + actl(rr)
s_for = s_for + forcst(rr)
Next rr
Fore = ForecastV + s_act - s_for

"Chip Pearson" wrote in message
...
Try something like

Fore = ForecastV + Application.Sum(Range(Act(1), Act(10)))


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Barmaley" wrote in message
...
this statement
Fore = ForecastV + sum(actl(1):actl(10))

has problem with ":"
I must be missing very simple but cannot see it today

Can you help me

Thanks









All times are GMT +1. The time now is 10:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com