Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Question about parsing a column of cells with a comma in text

Hello,

I have a column of cells that some of the cells have data like the following

124 Main Street, Suite 250

In a perfect world I would like to take the information after the comma and
move it to a cell next to it.

Then delete the comma.

Just posting on a remote chance that someone has done this before.

Thanks

Larry C

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Question about parsing a column of cells with a comma in text

Try some code like the following. Select the cells you want to change and
then run the code.


Sub SplitAddress()
Dim Rng As Range
Dim Arr As Variant
For Each Rng In Selection.Cells
If Rng.Text < vbNullString Then
Arr = Split(Rng.Text, ",")
Rng.Value = Arr(LBound(Arr))
If UBound(Arr) LBound(Arr) Then
Rng(1, 2).Value = Arr(LBound(Arr) + 1)
End If
End If
Next Rng
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Larry C" wrote in message
...
Hello,

I have a column of cells that some of the cells have data like the
following

124 Main Street, Suite 250

In a perfect world I would like to take the information after the comma
and move it to a cell next to it.

Then delete the comma.

Just posting on a remote chance that someone has done this before.

Thanks

Larry C


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Question about parsing a column of cells with a comma in text

Try selecting the column of addresses.
Then Data|Text to columns
(in the xl2003 menu system)
Delimited (by commas)
and finish up the wizard.

If you need a macro, record one when you do it manually.

Larry C wrote:

Hello,

I have a column of cells that some of the cells have data like the following

124 Main Street, Suite 250

In a perfect world I would like to take the information after the comma and
move it to a cell next to it.

Then delete the comma.

Just posting on a remote chance that someone has done this before.

Thanks

Larry C


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Question about parsing a column of cells with a comma in text

Thanks Guys

Both ideas are huge help

Larry C


"Dave Peterson" wrote in message
...
Try selecting the column of addresses.
Then Data|Text to columns
(in the xl2003 menu system)
Delimited (by commas)
and finish up the wizard.

If you need a macro, record one when you do it manually.

Larry C wrote:

Hello,

I have a column of cells that some of the cells have data like the
following

124 Main Street, Suite 250

In a perfect world I would like to take the information after the comma
and
move it to a cell next to it.

Then delete the comma.

Just posting on a remote chance that someone has done this before.

Thanks

Larry C


--

Dave Peterson


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
parsing name in cell by comma? Jon M Excel Worksheet Functions 3 December 31st 08 06:36 AM
text parsing/table creation from single column data cruiser Excel Discussion (Misc queries) 1 October 24th 07 12:19 PM
Parsing a text string into separate cells Bobalew Excel Worksheet Functions 1 June 6th 07 09:16 PM
Turning column contents into text list separated by a comma Kevin Rhinehart Excel Discussion (Misc queries) 1 January 16th 07 07:00 AM
parsing text in a multiple column count JK57 Excel Worksheet Functions 3 April 13th 06 11:03 AM


All times are GMT +1. The time now is 07:07 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"