automate 5 lines in a single column to 5 columns across

  • Thread starter Thread starter fyavorsky
  • Start date Start date
F

fyavorsky

I want to build a database.
I've extracted some text from my group's phone directory. It comes
out in one column with name on the first line, address on the second
line, city, state, zip on the third line and phone on the fourth line.
I'm trying to figure out a way to automate getting the info broken up
into columns.
I want to create a formula that will allow me to highlight 4 or 5 lines
and then break those lines into 4 or 5 columns.
My list has hundeds of names so cut and paste is a bit tedious.
Is there such a way to do this?
 
This should work with a single-block selection

Sub ReOrder()
Dim i As Long

For i = Selection.Rows.Count To 2 Step -1
Selection(1, 1).Offset(0, i - 1).Value = Selection(i, 1).Value
Selection(i, 1).EntireRow.Delete
Next i
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Why do you say "4 or 5 lines" into "4 or 5 columns"? Your illustration
indicates you need only 4 lines into 4 columns.

Alan Beban
 
OK. I'm new at this so bear with me. I did some web searches in trying
to figure out where to start. I found the Tools>Macros>VBE function. Am
I close? I copied your formula and pasted it into the window I got when
I double clicked on my worksheet in the VBE window. I selected "Run"
and got an error message :Compile Error, Syntax Error. Am I at all
close? What did I do wrong? Did I do ANYTHING right? ;-)
 
Where did you get the error?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top