IN EXCEL, HOW DO I KEEP TWO LINES OF DATA TOGETHER WHEN SORTING (N

C

Cheryl

In a data base, I have customer information and blank lines in between to
separate the data. I want to keep the blank lines under the customer
information to make the data base easier to read, how do I do this?
 
R

Ron100

One easy way - if there are not too many entries - is to repeat the entry in
the sort column on the blank line in white text.
Ron
 
O

Otto Moehrbach

Cheryl
This little macro will do that. As written, this macro sorts all data
from A2 down to the last entry in Column A, 7 columns wide. This will
remove all blank rows. This macro will then insert blank rows like you
want. Another way to get what you want, i.e. easier to read, is to have no
blank rows but color alternate rows. HTH Otto
Sub SortAll()
Dim rColA As Range
Dim c As Long
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
rColA.Resize(, 7).Sort Key1:=Range("A2"), Order1:=xlAscending,
Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
For c = rColA.Count To 1 Step -1
rColA(c).Offset(1).EntireRow.Insert
Next c
End Sub
 
G

Gord Dibben

Get rid of the blank lines and simply set the rows to double height.


Gord Dibben MS Excel MVP
 

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