mailing list transpose help

  • Thread starter Thread starter lucky_lowell
  • Start date Start date
L

lucky_lowell

I have a flat text file that looks like this
Mr and Mrs Smith
19 Elm Street
Boston, Ma 01231

Mark Hanson
Kathy Elmstead
13 sycamore drive
Bolston Mt 91320

Mark and Linda Everett
342 Pine Street
Austin, Tx 53221

it goes on for about 500 entries

I'd love to get it into this format

Mr and Mrs Smith 19 Elm Street Boston Ma 01676
etc

any clever ideas

thanks
Lowell
 
Lowell

To get into 3 or 4 columns per address.

Remember!! Always experiment on a copy of the sheet or book.

Public Sub AddressSort()
last = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
With Worksheets(1)
For x = last To 2 Step -1
If .Cells(x, 1).Value <> "" And _
Cells(x - 1, 1).Value <> "" Then
Range(.Cells(x, 1), .Cells(x, 10)).Copy _
Destination:=.Range(.Cells(x - 1, 2), .Cells(x - 1, 2))
Rows(x).Delete
End If
Next x
Range("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End With
End Sub

Copied to a general module in your workbook.

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the above code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to Tool>Macro>Macros.

Gord Dibben Excel MVP
 
Gord,

Your in my prayers!
Fast Effecient Thoughtful
and able to solve the problem!!!!!!

Gord for President!

Regards
Lowell
 

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

Similar Threads

Concatenating fields 0

Back
Top