Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Transpose addresses to columns

I have a question that is much like some that have already been posted, but
with a twist. I have a list of addresses that came off of the internet and
are all in one column. I need to transpose them into one row each, multiple
columns (ie, Name, Address, City, State, Zip, etc.), but the problem is that
they are not all currently the same number of rows. Some have faxes, some
don't. Some have 6 rows of info while others have 9. The commonalities are
that there is a blank row between each address, and each address has all of
the listed info in the same order (Name always comes fist, address second,
city, state zip third, phone fourth, fax fifth, etc.).

Is there a way to rearrange to at least get them into columns so I can come
back and do a little shifting around?

Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 192
Default Transpose addresses to columns

Hi Craig,

The following should do the trick. It starts in A1 so you'll have to adjust
if necessary.

Option Explicit
Sub rearrange()

Dim curselection As Range
Dim i As Integer

Set curselection = Range("A1") 'or wherever you start

Do While curselection < ""

If Not curselection.Offset(1, 0) = "" Then
i = 1
Do
curselection.Offset(1, 0).Copy Destination:=curselection.Offset(0, i)
curselection.Offset(1, 0).EntireRow.Delete
i = i + 1
Loop Until curselection.Offset(1, 0) = ""
End If

curselection.Offset(1, 0).EntireRow.Delete
Set curselection = curselection.Offset(1, 0)

Loop

End Sub
--
-SA


"Craig" wrote:

I have a question that is much like some that have already been posted, but
with a twist. I have a list of addresses that came off of the internet and
are all in one column. I need to transpose them into one row each, multiple
columns (ie, Name, Address, City, State, Zip, etc.), but the problem is that
they are not all currently the same number of rows. Some have faxes, some
don't. Some have 6 rows of info while others have 9. The commonalities are
that there is a blank row between each address, and each address has all of
the listed info in the same order (Name always comes fist, address second,
city, state zip third, phone fourth, fax fifth, etc.).

Is there a way to rearrange to at least get them into columns so I can come
back and do a little shifting around?

Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default Transpose addresses to columns

Brilliant! You just helped me skirt carpal tunnel for another day!

"StumpedAgain" wrote:

Hi Craig,

The following should do the trick. It starts in A1 so you'll have to adjust
if necessary.

Option Explicit
Sub rearrange()

Dim curselection As Range
Dim i As Integer

Set curselection = Range("A1") 'or wherever you start

Do While curselection < ""

If Not curselection.Offset(1, 0) = "" Then
i = 1
Do
curselection.Offset(1, 0).Copy Destination:=curselection.Offset(0, i)
curselection.Offset(1, 0).EntireRow.Delete
i = i + 1
Loop Until curselection.Offset(1, 0) = ""
End If

curselection.Offset(1, 0).EntireRow.Delete
Set curselection = curselection.Offset(1, 0)

Loop

End Sub
--
-SA


"Craig" wrote:

I have a question that is much like some that have already been posted, but
with a twist. I have a list of addresses that came off of the internet and
are all in one column. I need to transpose them into one row each, multiple
columns (ie, Name, Address, City, State, Zip, etc.), but the problem is that
they are not all currently the same number of rows. Some have faxes, some
don't. Some have 6 rows of info while others have 9. The commonalities are
that there is a blank row between each address, and each address has all of
the listed info in the same order (Name always comes fist, address second,
city, state zip third, phone fourth, fax fifth, etc.).

Is there a way to rearrange to at least get them into columns so I can come
back and do a little shifting around?

Thanks in advance.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to transpose a table into two columns? pemt Excel Discussion (Misc queries) 1 October 30th 09 10:53 PM
Transpose columns to rows using first columns repeated. hn7155 Excel Worksheet Functions 7 February 12th 09 11:50 PM
Excel Macro to transpose addresses from rows to columns Dave Excel Programming 3 June 3rd 07 07:07 PM
Macro to transpose names, addresses Dave Excel Programming 1 June 2nd 07 11:35 PM
Addresses To Columns Adria Draughn Excel Programming 0 July 23rd 04 02:57 AM


All times are GMT +1. The time now is 01:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"