Text to Columns via vba code

mdd16

Board Regular
Joined
Jan 11, 2011
Messages
84
Office Version
  1. 365
Platform
  1. Windows
[9:06 am, 14/10/2022] Raj: Dear all.
Please look at adapter issues
Do you have any reason for it?
[9:08 am, 14/10/2022] Mohan: We had tightened them before install ..
Please share your experience on this

I have this text in col A. Each line of text in separate row.
I want to move all the text that appears after second semi-colon to col B in same row.
In case there is no semi-colon then also do the same.

When I use "Text to Columns" command then problem I face is that text is separated to three columns due to two semi-colons in string. of course the second issue is that when there is no semi-colon, the text stays is col A only.

Image of what I want to achieve is attached.

Any help will be greatly appreciated.
 

Attachments

  • Text to col via VBA.jpg
    Text to col via VBA.jpg
    160.6 KB · Views: 8

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Don't know what version of excel you have but here is a formula option

Book1
ABC
1[9:06 am, 14/10/2022] Raj: Dear all.[9:06 am, 14/10/2022] Raj: Dear all.
2Please look at adapter issues Please look at adapter issues
3Do you have any reason for it? Do you have any reason for it?
4[9:08 am, 14/10/2022] Mohan: We had tightened them before install ..[9:08 am, 14/10/2022] Mohan: We had tightened them before install ..
5Please share your experience on this Please share your experience on this
Sheet1
Cell Formulas
RangeFormula
B1:B5B1=IF(SEARCH(C1,A1,1)=1,"",LEFT(A1,SEARCH(C1,A1,1)))
C1:C5C1=IFERROR(IF(FIND("[",A1)=1,RIGHT(A1,LEN(A1)-FIND(":",A1,5)),A1),A1)
 
Upvote 0
Solution
Thanks so much for your kind help bi will give it a try.
 
Upvote 0

Forum statistics

Threads
1,215,043
Messages
6,122,822
Members
449,096
Latest member
Erald

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