Split text in a column to multiple columns

M

milo

Can I split text in a column like the example below into
three columns?
Column = Column1 Column2 Column3
1 1234 John W. Doe = 1 1234 John W. Doe

Thanks,
milo
 
S

Schda

Okay this isn't the most elegant code, but I'm still learning, and will
always welcome tips on way to make my code more efficient. This should
work assuming your data is in column A.


Columns("B:E").Select
Selection.insert Shift:=xlToRight
Columns("A:A").Select
Application.DisplayAlerts = False
Selection.TextToColumns Destination:=Range("A1"),
DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True,
Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False,
FieldInfo _
:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1),
Array(5, 1))
Application.DisplayAlerts = True
Columns("C:C").Select
Selection.insert Shift:=xlToRight
Range("C1").Select
Do
ActiveCell.FormulaR1C1 = "=CONCATENATE(RC[1],"" "",RC[2],""
"",RC[3])"
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Offset(0, -2) = ""
Range("c:C").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Columns("D:F").Select
Selection.delete Shift:=xlToLeft
 
J

jimmy

the easiest way is to highlight all the colums and then go
to the data menu and go to 'text to columns' and then hit
next and put the line where you want to seperate them.
 

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

Excel Macro to Compare two Columns and write to a third 1
Text to Columns 2
Excel 2013 Merge Data 2
Deleting Column Based On Header 5
ODBC and Excel 1
Import Text File 2
moving cells 5
count dates 1

Top