Inserting a BLANK row

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,
I have a sheet that has a range that starts from row 33 and MAY (depending
on how many parameters/rows of data are required) extend up to row 43. What I
would like to do is insert a BLANK row between the lines of data. (Data is
column C).
I think the best way would be to search from row 33 down to see where the
last row of data is, then insert blank rows between the lines that contain
data.
Any help would be greatly appreciated!
 
Try this. Finds the last used row in Col C and inserts a blank line between
rows up to row 33.

Sub insertrows()
lastrowcolc = Range("C65536").End(xlUp).Row
For x = lastrowcolc To 2 Step -1
Rows(x).Select
Selection.Insert Shift:=xlDown
Next
End Sub

Mike
 
Hi Mike,
Thanks for taking the time to respond with a solution. This code does
work...however, can it be changed so that it does not copy the cell formats
from above/below....ie, cell border formatting. i would like the cells
completely empty with no borders on them. The cells above/below them DO have
borders and I'm assuming that this is copying the cell format from them.

thanks!
 
Tom,

It's not copying anything, if the original cells have borders then these
will be stretched when the new rows are inserted. This will remove them but
it's a bit of a mess because I don't know what borders I'm dealing with.

Sub insertrows()
lastrowcolc = Range("C65536").End(xlUp).Row
For x = lastrowcolc To 2 Step -1
Rows(x).Select
Selection.Insert Shift:=xlDown
Cells(x, 3).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Next
End Sub
 

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

Back
Top