Inserting new rows into sheet


Robert Crandal

I am using the following code to insert a new row onto
my spreadsheet:

Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

This code will insert a new row above the current row number 5, which
is okay. My problem is that the new row has the same height and possibly
dimensions and formatting of row 4.

Can I basically tell Excel to insert a row of cells that are a default size
a size of my specification?? I dont want Excel to insert a row of cells
are the same dimensions of the above or below row. I realize that I could
write code to resize the new cells, but I am curious if Excel has a setting
to stop it from copying the dimensions of adjacent cells.

Thank you



Jef Gorbach

Excel normally uses the default formatting when inserting a row,
however you're telling it to copy the format from the row above the
insertion point (via the optional
"CopyOrigin:=xlFormatFromLeftOrAbove" argument).

try simplifying your code to just: Rows("5:5").Insert



Robert Crandal

I must be doing something wrong, because that didn't work. I
tried both of the following options:



Rows("5:5").Insert Shift=xlDown

All cells in Row 4 have larger dimensions than all other cells on the
sheet. When I run the above code, Excel creates a row of cells that
all look like Row 4 cells.

Did I do something wrong???

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