ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro needed for sorting txt in a ceratian manner (https://www.excelbanter.com/excel-programming/289022-macro-needed-sorting-txt-ceratian-manner.html)

Martyn

macro needed for sorting txt in a ceratian manner
 
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.

Max

macro needed for sorting txt in a ceratian manner
 
The number of lines used for the address info may vary from one customer
to
another.


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)

--
Rgds
Max
xl 97
----------------------------------
Use xdemechanik <atyahoo<dotcom for email
-----------------------------------------
"Martyn" wrote in message
...
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





All times are GMT +1. The time now is 10:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com