View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
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