View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
KnightRiderAW KnightRiderAW is offline
external usenet poster
 
Posts: 20
Default Creating an Excel sheet with Addresses using a Macro

I have a list of addresses that are sepperated by a blank row. The address
number around 4000. All information is stored in Column A down each of the
rows. Instead, I would like it go across so that it is easy to merge into a
document for mailing. The addresses are similar to those below:

Company Name 1
123 Company Road
Any Town, AL 12345 - 6789
(555) 555-5555

Company Name 2
234 Company Road
Another Town, AK 23456-7890
(555) 555-0000

Company Name 3
Different Town, NY 34567-6543
(555) 555-1111

As you can see, some have three and some have four rows for the address (not
all of them have street addresses in them). What I want is something like
this:

Company Name 1 1234 Company Road Any Town, AL 12345 - 6789 (555)
555-5555
Company Name 2 234 Company Road Another Town, AK 23456-7890 (555)
555-0000
Company Name 3 Different Town, NY
34567-6543 (555) 555-1111

(Please note, I want the phone number in one column as it normally would
appear.) Just so you know, all of the Company Names are bold and of a blue
color (instead of black); not all of the zip codes are nine-digit, some are
five digit; all of the street addresses start with a number or "PO Box"; the
phone numbers are all formatted as (###) ###-#### and are bold; and there is
a blank (empty) cell at the end of each address. I have very little Macro
Programming, but I was thinking of something along the rough idea of:

Go to cell A2 and do the following for each
If the color of the selected cell is blue, then leave it where it is.
Increase the row of column A by 1 (in this case, A3)
If the selected cell begins with a number or "PO Box", then cut and paste it
to Column B one row above it's current spot, else cut and paste it to Column
C one row above it's current spot. Delete the empty cell left from the cut.
If the selected cell begins with a "(", then cut and paste it to Column D
one row above it's current spot. Delete the empty cell left from the cut.
If the selected cell is empty, then delete the empty cell and shift the rows
up.

Obviously this isn't programming language, but I thought I would get my
ideas out on paper first before attempting to get some coding help. Thanks
in advance for anyone's thoughts, comments, suggestions, and help on this!

Aaron