Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Split text into columns

Has anyone got any code that would split a name in one cell into three
columns. I have seen somewhere how to look for the space and so split it
up! An example of my data is:
Rev Christopher Dent


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 489
Default Split text into columns

I assume your names are in Col. A and you want the First Name in Col.B,
Middle Name in Col.C, and Last Name in Col.D. This will do it for you.

Sub SplitNames()

Dim rng As Range

For Each rng In Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
Range(Cells(rng.Row, rng.Column + 1), Cells(rng.Row, rng.Column +
3)) = Split(rng, " ")
Next rng

End Sub

Hope this helps! If so, let me know, click "YES" below.
--
Cheers,
Ryan


"Mervyn Thomas" wrote:

Has anyone got any code that would split a name in one cell into three
columns. I have seen somewhere how to look for the space and so split it
up! An example of my data is:
Rev Christopher Dent


.

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
Split Text in a Cell (4 columns) Elton Law[_2_] Excel Programming 1 October 15th 09 04:59 PM
Trim text and split across three columns Juswant Rai Excel Discussion (Misc queries) 4 September 4th 09 09:03 AM
Insert columns and split text mikebres Excel Programming 2 September 1st 07 07:58 AM
split text , insert to columns nshanmugaraj Excel Discussion (Misc queries) 4 March 3rd 06 01:17 PM
How do I split 16 char text 'XX XXX= +. X' into 16 columns Jeff Excel Discussion (Misc queries) 9 August 15th 05 02:17 PM


All times are GMT +1. The time now is 12:46 PM.

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"