Use a formula to set delimiter in text to columns?

griffo

Board Regular
Joined
Apr 19, 2004
Messages
142
Hi there

I'm using text to columns to split some data. My delimiter is a comma, but the problem is that there may be a random comma in the string that I don't want to use as a delimiter (ie it's not consecutive).

There is a pattern to what I want to use as the delimiter - it is number,space - eg 2,_ where the underscore is a space.

I have a basic recorded macro that this is a part of, so I'm guessing if this is possible it would involve changing the "Other:=False" part of the recorded code relating to the TextToColumns but I have no idea what to replace the False with.

Have tried searching the forum but wasn't able to find anything.

Cheers
Griffo
 
This will assign the character number of this comma and msgbox it:
Code:
Sub FindSpecificComma()
Dim Comma
Comma = InStr(1, Replace(ActiveCell.Value, ", ", "!@#$"), "!@#$")
MsgBox Mid(ActiveCell.Value, Comma - 1, 3)
End Sub
ZAX
 
Upvote 0

Forum statistics

Threads
1,226,878
Messages
6,193,464
Members
453,802
Latest member
SarahNoob

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