View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben[_2_] Gord Dibben[_2_] is offline
external usenet poster
 
Posts: 621
Default Variable SUM range

I am stuck with VBA syntax.


A1 has value of 123

A2 is blank

A3 also has value of 123

In A4 need a SUM range of A3 only

If A1:A3 all have values then need SUM range of A1:A3

This is what I have now but does not do the variable trick.

Set rng3 = Range(ActiveCell.Offset(-1, 0), _
ActiveCell.Offset(-1,0).End(xlUp))

ActiveCell.Formula = "=Sum(" & rng3.Address & ")"


Gord