Split Column Data

sewak

New Member
Joined
Oct 7, 2014
Messages
2
For Example I have a text in A1

A1= Elevit Products - Vitamins For Pre-Conception, - Pregnancy And Breastfeeding. - www.elevit.com.au/Elevit

<tbody>
</tbody>

How to show data like

A2= Elevit Products
A3=www.elevit.com.au/Elevit
A4=Vitamins For Pre-Conception
A5=Pregnancy And Breastfeeding

For your information: Pre-Conception is one word, not separated by spaces like others.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I need to show each value separated by " - " (two space before and after dash) in A2 , A3 and A4.
 
Upvote 0
Here's one way using the VBA "Split" function.

In a standard module:
Code:
Public Sub Test()

Dim oCell As Range
Dim oOutPut As Range
Dim oTarget As Range
Dim vElement As Variant
Dim vSplit As Variant

Set oTarget = ActiveSheet.Range("A1:A" & ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row)

For Each oCell In oTarget
    Set oOutPut = oCell.Offset(0, 1)
    vSplit = Split(oCell.Text, " - ") ' Delimiter <space> <dash> <space>
    For Each vElement In vSplit
        oOutPut.Value = vElement
        Set oOutPut = oOutPut.Offset(0, 1)
    Next vElement
Next oCell

End Sub
</space></dash></space>
 
Upvote 0

Forum statistics

Threads
1,207,402
Messages
6,078,263
Members
446,324
Latest member
JKamlet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top