From the comments, I see that you are stuck with the variable number of rows of first block.

This is simple maths:

You know that first row of first block is

`StartBundleRow`

= 11You know that the number of rows in first block is

`bundleRows`

Deduce that Last row of first block is

`StartBundleRow`

+ `bundleRows`

- 1add 6 blank rows

`StartBundleRow`

+ `bundleRows`

- 1 + 6Second block start on next row

`StartBundleRow`

+ `bundleRows`

- 1 + 6 + 1 which gives `StartBundleRow`

+ `bundleRows`

+ 6and you are done.

This kind of things is the basic of programming.

int StartBundleRow = 11;

for (int BndlRow = 0; BndlRow < bundleRows; BndlRow++) //add bundle rows to spreadsheet

{

worksheet.Rows[StartBundleRow].Insert();

What confuses me in your example is worksheet.Rows[StartBundleRow].Insert(); I think it should be worksheet.Rows[StartBundleRow + BndlRow ].Insert(); this would create a number of bundlerows instead of just one.