Inserting Rows and Columns

Inserting Entire Rows
            // Insert 1 row below row(3)
            ws.Row(3).InsertRowsBelow(1);

            // Insert 1 row above row(3)
            ws.Row(3).InsertRowsAbove(1);

Inserting Entire Columns
            // Insert 1 column after column(3)
            ws.Column(3).InsertColumnsAfter(1);

            // Insert 1 column before column("C")
            ws.Column("C").InsertColumnsBefore(1);

Inserting Rows in a Range
            // Insert 1 row below a range
            ws.Range("A1:B3").InsertRowsBelow(1);

            // Insert 1 row above a range
            ws.Range("A1:B3").InsertRowsAbove(1);

Inserting Columns in a range
            // Insert 1 column after a range
            ws.Range("A1:B3).InsertColumnsAfter(1);

            // Insert 1 column before a range
            ws.Range("A1:B3).InsertColumnsBefore(1);

Last edited Sep 10, 2010 at 8:13 PM by MDeLeon, version 3