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
I didn't see Sid Holland's post until after my lunch break, where a co-worker sent me this code that does basically the same thing as his...
private void CopyRowsDown(int startrow, int count, Excel.Range oRange, Excel.Worksheet oSheet)
{
oRange = oSheet.get_Range(String.Format("{0}:{0}", startrow), System.Type.Missing);
oRange.Select();
oRange.Copy();
//oApp.Selection.Copy();
oRange = oSheet.get_Range(String.Format("{0}:{1}", startrow + 1, startrow + count - 1), System.Type.Missing);
oRange.Select();
oRange.Insert(-4121);
//oApp.Selection.Insert(-4121);
}
Worked perfectly, even when count is 1.