VBA to Convert Comma Delimited Cell into Rows With values in Other Columns

desairs

New Member
Joined
Oct 17, 2013
Messages
2
So I have used MrExcel a lot in the past, but I haven't ever had a question that has not been answered. Thank you for all of the help over the years.

I have found that recently, I have been getting a few spreadsheets where there are a multiple columns with one data item each and one column at the end with cells that contain comma or pipe delimited values. The number of delimited values is not consistent between rows.

I need VBA where I can define the number of columns to copy down and the column that contains the comma separated values and run it to convert the delimited cell to rows with the information from the other columns included. I have tried to figure it out but I am definitely stuck on this. I have included a sample of what I am

I.e.

Before

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Heading1[/TD]
[TD]Heading2[/TD]
[TD]Heading3[/TD]
[TD]Heading4[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]A,B,C[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]D,E,F,G[/TD]
[/TR]
</tbody>[/TABLE]

After


[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Heading1[/TD]
[TD]Heading2[/TD]
[TD]Heading3[/TD]
[TD]Heading4[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]G[/TD]
[/TR]
</tbody>[/TABLE]



I appreciate any help I can get. It's possible that there is a topic on this but I was searching for the wrong thing.
 

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