Adding a block of data

  • Thread starter Thread starter JM
  • Start date Start date
J

JM

Hi there,

Would welcome advice on the following.

Trying to add a block of data (say cell h8 to H12) iusing
the following statement

row_no = ActiveCell.Row
ActiveCell.Offset(1#).FormulaR1C1 = "=Sum(R[-" + Trim(Str
(row_no)) + "]c:r[-1]c)"
The formula sadly adds cell H1 to H12.....


Any idea as to how to only get the statement / formulae to
return the sum of cells H8 to H12

Thanks in advance
 
This looks like an Exel VBA question. Are you doing this in VB.net?

In any case, Offset takes two parameters. Try something as follows:
row_no = ActiveCell.Row
ActiveCell.Offset(1, 0).FormulaR1C1 = "=Sum(R[-" + Trim(Str(row_no)) +
"]c:r[-1]c)"



Hope this helps!
Bharat Patel
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.
 
Back
Top