how to add(insert) rows programmatically

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
 
M

mp

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top