excel - VBA sum of a range withing vba not working? -


i writing small macro calculations me before displaying them "sum" function within macro doesnt seem working?

sub compiledashboard()     = 3 100         if sheets(1).cells(i, "a").value = "week 36"              sheets(2).cells(1, 1) = application.worksheetfunction.sum(range(cells(i, "an"), cells(i, "bf")))          end if     next  end sub 

this jsut simplification of step isnt working , i'm not sure why isnt summing? outputs 0 despite values in range.

as mentioned in comments line:

sheets(2).cells(1, 1) = application.worksheetfunction.sum(range(cells(i, "an"), cells(i, "bf")))

needs changed to

sheets(2).cells(i, 1) = application.worksheetfunction.sum(range(cells(i, "an"), cells(i, "bf")))

just variation on theme. syntax, never see it.

sub compiledashboard()     dim integer     sheets(1)         = 3 100             .rows(i)                 if .columns("a").value = "week 36"                      sheets(2).cells(i, 1) = application.sum(.columns("an:bf"))                  end if             end         next      end end sub 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -