views:

388

answers:

1

I have a C# application that builds Excel files from an existing template. On the template I want to have my row totals/averages in place and to update to however many rows are inserted by the application (Between the header and footer rows). This should be simple but I am drawing a blank in trying to remember how to do such a thing.

+3  A: 

Excel should automatically update the ranges in the footer formulas providing that the footer formulas reference at least two rows and the insertion happens between those two rows.

updated to reflect suggestions from ewbi's comment below

TimS
I don't believe you even need named ranges, as Excel will properly expand the range of the addresses in the footer's SUM, AVG, etc. functions with each row insertion, assuming 1) the addresses in the functions begin by covering at least 2 rows (i.e., A2:A3), and 2) the insertion always occurs below the first row and on or above the second.
ewbi
true, good point, I'll update my answer accordingly, actually.
TimS