inserting lines throughout a spreadsheet

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

Guest

If I have a spreadsheet and I make it where there are blank cells between by
data, I then sort and the blank lines are then removed. How do I easily
insert blank cells throught by spreadsheet without physically inserting the
row on every line.
 
Kerry
This macro will do that for you. I assumed you have data in Column A
starting with A2 (A1 is a header). Change the column and row as needed.
HTH Otto
Sub InsertBlank()
Dim RngColA As Range
Dim c As Long
Application.ScreenUpdating = False
Set RngColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For c = RngColA.Count To 1 Step -1
RngColA(c).Offset(1).EntireRow.Insert
Next c
Application.ScreenUpdating = True
End Sub
 
The macro worked greated. However, I do my sort, run the macro, then it does
not keep the sort. it puts it back in the same order it was in. Can you
sort, run macro, and have it keep the sort you ran?
 
Kerry
The macro I gave you does nothing with the sort. It simply takes what's
there and inserts a blank row after every row of data you have. If your
data is being sorted after my macro runs, then you must have other macros
running after mine. I don't know what your file has or how it operates so I
can't advise you there, but the macro I sent you does not sort anything.
HTH Otto
 

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