how to add(insert) rows programmatically

  • Thread starter Thread starter mp
  • Start date Start date
M

mp

I'm trying to add 3 blank rows at the top of a sheet
i have a reference to the workbook and worksheet
i've searched googe for a while and there are lots of samples but none that
i can get to convert
(i'm in c# using com interop but if someone shows a vb6 way i'm sure i can
convert that)
i don't think all the sites you find on the web have good code, so thats why
i'm asking here.
thanks
mark
 
figured it out...

private void insertRows(Worksheet xlWorkSheet,int numRows )
{
object misValue = System.Reflection.Missing.Value;
for (int i = 0; i < numRows; i++)
{
Range rng = (Range)xlWorkSheet.Cells[1, 1];
rng.EntireRow.Insert(misValue, misValue);
}
}
thanks anyway,
mark
 
Back
Top