Need help with a macro!

mr.durden

New Member
Joined
Oct 17, 2012
Messages
14
Hi there,

I have a spreadsheet which has been awkwardly formatted by a client with over 50,000 rows. I've tried creating my own macro to automate the work but it just won't seem to work (i'm probably missing something obvious).

At the moment the data looks like this:

[TABLE="width: 377"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]00229268[/TD]
[TD]Example 1[/TD]
[TD]6089+8038[/TD]
[/TR]
[TR]
[TD]00157910[/TD]
[TD]Example 2[/TD]
[TD]6090+6274[/TD]
[/TR]
</tbody>[/TABLE]

I want it to look like this:

[TABLE="width: 377"]
<tbody>[TR]
[TD]00229268[/TD]
[TD]Example 1[/TD]
[TD]6089[/TD]
[/TR]
[TR]
[TD]00229268[/TD]
[TD]Example 1[/TD]
[TD]8038[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 377"]
<tbody>[TR]
[TD]00157910[/TD]
[TD]Example 2[/TD]
[TD]6090[/TD]
[/TR]
[TR]
[TD]00157910[/TD]
[TD]Example 2[/TD]
[TD]6274[/TD]
[/TR]
</tbody>[/TABLE]


At the moment I am copying and inserting endlessly. Please help me!

Thanks
 
Hi Tiger,

Thanks for this. I tried to run it but it brought up a debug error on this line of code:

<code>For varNum = Split(Cells(rIndex, strSplitCol).Value, "-")(0) To Split(Cells(rIndex, strSplitCol).Value, "-")(1)</code>

Any ideas?
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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