Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to shift address info. from rows to columns?

I have a mailing list with name, address, city, state & zip with each item in individual rows like a list of labels and a few empty rows of space between each listing. How do I create/transfer this list into columns accross so I can sort by city or zip? Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How to shift address info. from rows to columns?

Mark

First thing. Is the data consistent? You show 5 rows of data for each group.
Is this what you have in the column? If you have spaces(blank rows) between
your data as you state you should get rid of them. Select the range of data
in Column A and EditGo ToSpecialBlanks. With blanks selected
EditDeleteEntire Row.

Now, copy/paste this macro to a Module in your workbook. To get to the Visual
Basic Editor hit ALT + F11. Select from Menu InsertModule and paste in the
code.

ALT + Q to go back to your worksheet. ALT + F8 to open Macro dialog box.
Select the coltorows macro and Run it.

You will be asked how many columns you wish. In the case of your example you
would pick 5. OK and your data will be laid out as shown below.

name address city state zip
name address city state zip
name address city state zip

If your data is not consistent, maybe an address or a state missing, you
could leave a blank space in that row of your list. Try it and see if it
meets your needs.

Sub ColtoRows()
Dim rng As Range
Dim i As Long
Dim j As Long
Dim nocols As Integer
Set rng = Cells(Rows.Count, 1).End(xlUp)
j = 1
nocols = InputBox("Enter Number of Columns Desired")
If Not IsNumeric(nocols) Then Exit Sub
For i = 1 To rng.Row Step nocols
Cells(j, "A").Resize(1, nocols).Value = _
Application.Transpose(Cells(i, "A").Resize(nocols, 1))
j = j + 1
Next
Range(Cells(j, "A"), Cells(rng.Row, "A")).ClearContents
End Sub

Gord Dibben XL2002

On Mon, 24 Nov 2003 19:56:04 -0800, "Mark" wrote:

I have a mailing list with name, address, city, state & zip with each item in individual rows like a list of labels and a few empty rows of space between each listing. How do I create/transfer this list into columns accross so I can sort by city or zip? Thank you!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default How to shift address info. from rows to columns?

I answered a very similar question a few weeks ago with a
full code listing ...suggest you do a search


Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I have a mailing list with name, address, city, state &

zip with each item in individual rows like a list of
labels and a few empty rows of space between each
listing. How do I create/transfer this list into columns
accross so I can sort by city or zip? Thank you!

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default How to shift address info. from rows to columns?

This procedure assumes
(1) addresses start at row 1
(2) addresses are three lines
(3) there is one blank row between then lines

Row 1 : Address1 line 1
Row 2 : Address1 line 2
Row 3 : Address1 line 3
Row 4 : Blank
Row 5 : Address2 line 1
Row 6 : Address2 line 2
Row 7 : Address2 line 3
Row 8 : Blank
etc

Sub AdjustAddresses()
Dim rw As Long

rw = 1

Do Until Cells(rw, 1).Value = ""

Cells(rw, 2).Value = Cells(rw + 1, 1).Value
Cells(rw, 3).Value = Cells(rw + 2, 1).Value

Rows(rw + 2).Delete
Rows(rw + 1).Delete
Rows(rw + 1).Delete

rw = rw + 1


Loop



End Sub

HTH
Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I have a mailing list with name, address, city, state &

zip with each item in individual rows like a list of
labels and a few empty rows of space between each
listing. How do I create/transfer this list into columns
accross so I can sort by city or zip? Thank you!

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default How to shift address info. from rows to columns?

Please do not multi-post.

See one reply in .misc
(A possible non-macro way)

--
hth
Max
-----------------------------------------
Please reply in newsgroup

Use xdemechanik
<atyahoo<dotcom for email
--------------------------------------------------
"Mark" wrote in message
...
I have a mailing list with name, address, city, state & zip with each item

in individual rows like a list of labels and a few empty rows of space
between each listing. How do I create/transfer this list into columns
accross so I can sort by city or zip? Thank you!



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
Moving info from rows to columns Mary Lou[_2_] Excel Worksheet Functions 2 October 28th 09 01:34 AM
Splitting Address Info - Text to Columns betany70 Excel Discussion (Misc queries) 4 October 12th 07 09:54 PM
Change rows into columns, 90 degree shift v-jo58 Excel Discussion (Misc queries) 3 May 1st 06 09:23 PM
Rearrange info in rows to columns - HELP! LaVerne Excel Discussion (Misc queries) 0 June 20th 05 09:40 PM
LINKING Address cells from an EXCEL spreadsheet to fill MapQuest Address Info Duane S. Meyer Excel Programming 0 August 30th 03 12:16 AM


All times are GMT +1. The time now is 11:53 PM.

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

About Us

"It's about Microsoft Excel"