I have an Excel \'07 Template file for a purchase order. On the template, there\'s only room for 3 rows worth of items, then the template shows the Total.
So, basica
public static void CopyRowsDown(_Worksheet worksheet, int startRowIndex, int countToCopy)
{
for (int i = 1; i < countToCopy; i++)
{
var range = worksheet.get_Range(string.Format("{0}:{0}", startRowIndex, Type.Missing));
range.Select();
range.Copy();
range = worksheet.get_Range(string.Format("{0}:{1}", startRowIndex + i, startRowIndex + i, Type.Missing));
range.Select();
range.Insert(-4121);
}
}
works for any count