VBA Script - Split the string into separate columns

fahadalambd

New Member
Joined
Sep 16, 2022
Messages
31
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

I hope everyone is doing well.

As you can see in the attached pics - in "sheet1" I have a special character ( | ) between strings. I need the VBA script that can split the string into different columns

"Sheet2" is the Final answer that I expect.

It will be really appreciated if someone helps me to find the answer.

Thanks in advance.
 

Attachments

  • Sheet1.png
    Sheet1.png
    13.4 KB · Views: 11
  • Sheet2 - Final.png
    Sheet2 - Final.png
    15 KB · Views: 10

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Will there always be only two or three components in each address? Just out of curiosity, you have city names in the address column. I suspect that the pictures you posted don't reflect your actual data. If so, please post samples of your actual data. Also, it is hard to work with pictures. It would be easier to help if you could use the XL2BB add-in (icon in the menu) to attach a screenshot (not a picture) of Sheet1. Alternately, you could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Explain in detail what you want to do referring to specific cells, rows, columns and sheets using a few examples from your data (de-sensitized if necessary).
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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