macro needed for sorting txt in a ceratian manner

M

Martyn

Hi,

I have records of customers with names and address info as below in an excel
sheet on column A:A:
=================
Name of Customer A
Adres of customerA

Name of Customer B
Adres of customerB
.....
....
...
Name of Customer XY
Adress of customer XY
=========================
The number of lines used for the address info may vary from one customer to
another. But there is at least one "empty" line between each customer. I
also don't know the exact number of customers...It's a long list.

I need to sort this list onto another sheet in the workbook, so that the
names will reside under column A and corresponding address info's on column
B.

The output should look like this:

1 Customer A Adress of customer A
2 Customer B Address of customer B
.....
...
N Customer N Address of customer N

Could anyone suggest a macro solution for this situation?
Thanks

Martyn
 
M

Max

The number of lines used for the address info may vary from one customer
to

If the above doesn't really apply,
i.e. the name / address data is in groups of 2 lines each,
viz. your illustration:
Name of Customer A
Adres of customerA

Name of Customer B
Adres of customerB

(the number of blank rows in-between groups doesn't matter, it can be
uneven)

then you may wish to try
: http://tinyurl.com/36qxl

for a workable non-macro solution

Your situation is 2 lines per group, so the formula in B2 would be:

: =INDIRECT("A"&2*ROW()-2+COLUMN()-2)

Copy B2 across to C2, then copy down until zeros appear

Copy > Paste special > values on another sheet
(to freeze the values in cols B & C)
 

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