At work I often have an excel sheet with many columns. The cell in the last column of each row has a comma delimited list. I'd like to duplicate each row and separate the last cell into each section of the delimited list. For example if my table looks like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]a, b, c[/TD]
[/TR]
[TR]
[TD]St. Louis[/TD]
[TD]Rem[/TD]
[TD]Display[/TD]
[TD]d, e[/TD]
[/TR]
</tbody>[/TABLE]
I would like to create this:[TABLE="width: 500"]
<tbody>[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]St. Louis[/TD]
[TD]Rem[/TD]
[TD]Display[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]St. Louis[/TD]
[TD]Rem[/TD]
[TD]Display[/TD]
[TD]e[/TD]
[/TR]
</tbody>[/TABLE]
Not sure what the best way is to go about this. Perhaps I need to create an array for each row of the last cell and say for each value in that array create a new row and copy the values down? I haven't played in VBA for a while. Often my original excel documents have 50 rows and many more columns with an assortment of values, so separating everything becomes tedious and time consuming. Any advice is appreciated. Thanks!
[TABLE="width: 500"]
<tbody>[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]a, b, c[/TD]
[/TR]
[TR]
[TD]St. Louis[/TD]
[TD]Rem[/TD]
[TD]Display[/TD]
[TD]d, e[/TD]
[/TR]
</tbody>[/TABLE]
I would like to create this:[TABLE="width: 500"]
<tbody>[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]a[/TD]
[/TR]
[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]b[/TD]
[/TR]
[TR]
[TD]Kansas City[/TD]
[TD]Custom[/TD]
[TD]Display[/TD]
[TD]c[/TD]
[/TR]
[TR]
[TD]St. Louis[/TD]
[TD]Rem[/TD]
[TD]Display[/TD]
[TD]d[/TD]
[/TR]
[TR]
[TD]St. Louis[/TD]
[TD]Rem[/TD]
[TD]Display[/TD]
[TD]e[/TD]
[/TR]
</tbody>[/TABLE]
Not sure what the best way is to go about this. Perhaps I need to create an array for each row of the last cell and say for each value in that array create a new row and copy the values down? I haven't played in VBA for a while. Often my original excel documents have 50 rows and many more columns with an assortment of values, so separating everything becomes tedious and time consuming. Any advice is appreciated. Thanks!
Last edited: