Splitting cell content and populating other cells

heideway

New Member
Joined
Jul 18, 2011
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Hi, my first post here (been lurking for a while)

Hoping someone can help me with a coding solution to the following.

I have a cell, say J2, with a number of text fields separated by commas e.g. FSA1,LH2,FSA3,LH4. I want to split out the text between commas and place each on in its own cell e.g Cell J3 = FSA1, J4 = LH2, J5 = FSA3.

The source cell can have between 1 and 25 of these codes.

Your help on how to approach this in VBA (using 2007) would be much appreciated..
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try

Code:
Sub ASplit()
Dim X
With Range("J2")
    X = Split(.Value, ",")
    .Offset(1).Resize(UBound(X) + 1).Value = Application.Transpose(X)
End With
End Sub
 
Upvote 0
Try

Code:
Sub ASplit()
Dim X
With Range("J2")
    X = Split(.Value, ",")
    .Offset(1).Resize(UBound(X) + 1).Value = Application.Transpose(X)
End With
End Sub

Thanks VoG,

Helped in under 30 seconds from posting - awesome.....;)
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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