split data in cells VBA

davewatson86

New Member
Joined
Jul 8, 2019
Messages
30
hi all

this is probably really simple but all i have been ale to find is spit with commas etc.

i have data that displays as below in column A


102269 Robinson's Body Centre
102288 C & S Bodycare Ltd
102329 Cooper Norwich
102362 V B S
102430 Bracken Brae Garage
102452 B.M Page & Son
102455 Frettenham Service Station
102477 H Curtis & Son
102526 Leeders Accident Centre Ltd
102531 Langor Bridge Garage
102542 R & M Eke Motor Engineers
102654 Banham Vehicle Services Ltd
102675 Scole Engineering
102691 Cathedral Garage
102701 Surlingham Garage
102703 Yelverton Garage Ltd


what would be the most efficient way to separate this data into this.

column A Column B
102269Robinson's Body Centre
102288C & S Bodycare Ltd
102329Cooper Norwich
102362V B S
102430Bracken Brae Garage
102452B.M Page & Son
102455Frettenham Service Station
102477H Curtis & Son
102526Leeders Accident Centre Ltd
102531Langor Bridge Garage
102542R & M Eke Motor Engineers
102654Banham Vehicle Services Ltd
102675Scole Engineering
102691Cathedral Garage
102701Surlingham Garage
102703Yelverton Garage Ltd

<colgroup><col><col></colgroup><tbody>
</tbody>

i have thousands of Rows of data to process every time the data is updated.

thank you for any help.

Dave

<colgroup><col></colgroup><tbody>
</tbody>
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
You could use these two:

=0+LEFT(A2,FIND(" ",A2)-1)

=MID(A2,FIND(" ",A2)+1,999)
 
Upvote 0
You could just as well do this manually with Text to Columns (on the Data ribbon tab) but if you want to do it by vba per your thread title, try the following in a copy of your workbook.

Code:
Sub Text_To_Columns()  
  Range("A1", Range("A" & Rows.Count).End(xlUp)).TextToColumns DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(6, 1))
End Sub
 
Last edited:
Upvote 0
You could just as well do this manually with Text to Columns (on the Data ribbon tab) but if you want to do it by vba per your thread title, try the following in a copy of your workbook.

Code:
Sub Text_To_Columns()  
  Range("A1", Range("A" & Rows.Count).End(xlUp)).TextToColumns DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1), Array(6, 1))
End Sub

thank you Peter_SSs

that worked a treat
 
Upvote 0

Forum statistics

Threads
1,213,535
Messages
6,114,194
Members
448,554
Latest member
Gleisner2

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