VBA code to split a cell at a space into 2 cells

jtpryan

New Member
Joined
May 14, 2014
Messages
23
I have a sheet with a column of data that looks like this:

thisisallonebigword nnn.n

So 2 parts separated by a space with the n=to numbers, seconds actually. Anyway I need to run down the column and split it into 2 columns, the text in one, the numbers in the next column. This is the last column in the sheet so I don't need to insert another one. I thought this would be simple but all I can find is (what seems to be) very complex answers.

Thank you all.

Jim
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
You don't need VBA to do this. It can be done very easily using Text to Columns.
Just highlight your column, go to Text to Columns (from the Data menu), select Delimited, choose the Space as your delimiter, and click Finish.
If you want the VBA code equivalent, just turn on the Macro Recorder while you perform the steps above manually.
 
Upvote 0
Joe,

I'm sorry, should have been clearer. This is part of a much larger VBA script that I am writing, so I do need a VBA solution.


Thank you for the quick reply.


Jim
 
Upvote 0
This is part of a much larger <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: dotted; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(0, 0, 0); border-left-color: initial; border-image: initial; cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> script that I am writing, so I do need a <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: dotted; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(0, 0, 0); border-left-color: initial; border-image: initial; cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> solution.
Re-read my last line. The Macro Recorder is a VBA noob's best friend! You can get a lot of code snippets without having to write anything at all!;)
If you want the <acronym title="visual basic for applications" style="border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: dotted; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(0, 0, 0); border-left-color: initial; border-image: initial; cursor: help; color: rgb(51, 51, 51); background-color: rgb(250, 250, 250);">VBA</acronym> code equivalent, just turn on the Macro Recorder while you perform the steps above manually.
 
Upvote 0

Forum statistics

Threads
1,216,100
Messages
6,128,824
Members
449,470
Latest member
Subhash Chand

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