Hi

I have a excel template and am using

worksheet.Cells[RowCnt , ColCnt].PutValue(12)

to insert values into each cells.I have one "Subtotal" formula in my Template like

=SUBTOTAL(9,A3:A1048576) in my A1 cell.Its working fine.But my problem is in my template i given till last row number in the subtotal formula,because i don't know the number of rows at first time.Because of this Subtotal formula my template size is more.So my requrement is instead of giving last row number,at the time of looping my dataset how to auto increment my subtotal formula,that is

while creating the template i will create the subtotal like "=SUBTOTAL(9,A3:A3)" and when am looping my dataset i need to increment subtotal like "=SUBTOTAL(9,A3:A4)" ,"=SUBTOTAL(9,A3:A5)".*One important thing is if subtotal formula is there in A1 cell,then only i should do all these things.I know how to find ,there is a formula in cell or not,worksheet.Cells[RowCnt , ColCnt].IsFormula,but how to find that formula is a Subtotal formula*

So my Requirement is if there is a subtotal in particular "column",just auto increment that subtotal formula in each loop of my dataset

Am attaching my Sample template and please check where and all i kept Subtotal formula

I added Comments on subtotal

Regards

Ajeesh M J