Splitting a table and formatting problem

EPortJake

New Member
Joined
Jan 18, 2019
Messages
1
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD="align: center"]E
[/TD]
[/TR]
[TR]
[TD]38
[/TD]
[TD]No
[/TD]
[TD]OP
[/TD]
[TD]MO
[/TD]
[TD]Txt
[/TD]
[TD]Co
[/TD]
[/TR]
[TR]
[TD]39
[/TD]
[TD]112254
[/TD]
[TD]10
[/TD]
[TD]04 FSR
[/TD]
[TD]Yeah
[/TD]
[TD]ABB
[/TD]
[/TR]
[TR]
[TD]40
[/TD]
[TD]114554
[/TD]
[TD]20
[/TD]
[TD]04 FLB
[/TD]
[TD]Whatever
[/TD]
[TD]ABB
[/TD]
[/TR]
[TR]
[TD]41
[/TD]
[TD]144754
[/TD]
[TD]10
[/TD]
[TD]04 BBA
[/TD]
[TD]Etc
[/TD]
[TD]Claptrap
[/TD]
[/TR]
[TR]
[TD]42
[/TD]
[TD]112266
[/TD]
[TD]40
[/TD]
[TD]04 KKT
[/TD]
[TD]Blah
[/TD]
[TD]Claptrap
[/TD]
[/TR]
[TR]
[TD]43
[/TD]
[TD]123457
[/TD]
[TD]15
[/TD]
[TD]04 JJF
[/TD]
[TD]Blah
[/TD]
[TD]Claptrap
[/TD]
[/TR]
[TR]
[TD]44
[/TD]
[TD]111365
[/TD]
[TD]10
[/TD]
[TD]04 MMN
[/TD]
[TD]Blah
[/TD]
[TD]Gardner
[/TD]
[/TR]
[TR]
[TD]45
[/TD]
[TD]125845
[/TD]
[TD]100
[/TD]
[TD]04 FSR
[/TD]
[TD]Blah
[/TD]
[TD]Gardner
[/TD]
[/TR]
[TR]
[TD]46
[/TD]
[TD]124655
[/TD]
[TD]50
[/TD]
[TD]04 HHY
[/TD]
[TD]Blah
[/TD]
[TD]Zeus
[/TD]
[/TR]
</tbody>[/TABLE]
Hi,
I am struggling with the code needed to format a table by a common variable. The table looks like the above and is compiled in Co alphabetic order. I'm needing a macro that will split the table into common Co, put the Coname above with column titles, insert some cells below (N2:Y6) followed by a page break so it looks like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD="align: center"]E
[/TD]
[/TR]
[TR]
[TD]37
[/TD]
[TD][/TD]
[TD]ABB
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]38
[/TD]
[TD]No
[/TD]
[TD]OP
[/TD]
[TD]MO
[/TD]
[TD]Txt
[/TD]
[TD]Co
[/TD]
[/TR]
[TR]
[TD]39
[/TD]
[TD]112254
[/TD]
[TD]10
[/TD]
[TD]04 FSR
[/TD]
[TD]Yeah
[/TD]
[TD]ABB
[/TD]
[/TR]
[TR]
[TD]40
[/TD]
[TD]114554
[/TD]
[TD]20
[/TD]
[TD]04 FLB
[/TD]
[TD]Whatever
[/TD]
[TD]ABB
[/TD]
[/TR]
[TR]
[TD]41
[/TD]
[TD][/TD]
[TD](Paste N2:Y6 here)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]42
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]43
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]44
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]45
[/TD]
[TD][/TD]
[TD](Page break below)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]46
[/TD]
[TD][/TD]
[TD]Claptrap
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]47
[/TD]
[TD]No
[/TD]
[TD]OP
[/TD]
[TD]MO
[/TD]
[TD]Txt
[/TD]
[TD]Co
[/TD]
[/TR]
[TR]
[TD]48
[/TD]
[TD]144754
[/TD]
[TD]10
[/TD]
[TD]04 BBA
[/TD]
[TD]Etc
[/TD]
[TD]Claptrap
[/TD]
[/TR]
[TR]
[TD]49
[/TD]
[TD]112266
[/TD]
[TD]40
[/TD]
[TD]04 KKT
[/TD]
[TD]Blah
[/TD]
[TD]Claptrap
[/TD]
[/TR]
[TR]
[TD]50
[/TD]
[TD]123457
[/TD]
[TD]15
[/TD]
[TD]04 JJF
[/TD]
[TD]Blah
[/TD]
[TD]Claptrap
[/TD]
[/TR]
[TR]
[TD]51
[/TD]
[TD][/TD]
[TD](Paste N2:Y6 here)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]52
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]53
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]54
[/TD]
[TD][/TD]
[TD](Page break below)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]55
[/TD]
[TD][/TD]
[TD]Gardner
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]56
[/TD]
[TD]No
[/TD]
[TD]OP
[/TD]
[TD]MO
[/TD]
[TD]Txt
[/TD]
[TD]Co
[/TD]
[/TR]
[TR]
[TD]57
[/TD]
[TD]111365
[/TD]
[TD]10
[/TD]
[TD]04 MMN
[/TD]
[TD]Blah
[/TD]
[TD]Gardner
[/TD]
[/TR]
[TR]
[TD]58
[/TD]
[TD]125845
[/TD]
[TD]100
[/TD]
[TD]04 FSR
[/TD]
[TD]Blah
[/TD]
[TD]Gardner
[/TD]
[/TR]
[TR]
[TD]59
[/TD]
[TD][/TD]
[TD](Paste N2:Y6 here)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]60
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]61
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]62
[/TD]
[TD][/TD]
[TD](Page break below)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]63
[/TD]
[TD][/TD]
[TD]Zeus
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]64
[/TD]
[TD]No
[/TD]
[TD]MO
[/TD]
[TD]OP
[/TD]
[TD]Txt
[/TD]
[TD]Co
[/TD]
[/TR]
[TR]
[TD]65
[/TD]
[TD]124655
[/TD]
[TD]50
[/TD]
[TD]04 HHY
[/TD]
[TD]Blah
[/TD]
[TD]Zeus
[/TD]
[/TR]
[TR]
[TD]66
[/TD]
[TD][/TD]
[TD](Paste N2:Y6 here)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]67

[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]68
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]69
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]70
[/TD]
[TD][/TD]
[TD](Page break below)
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Any help would be greatly appreciated. Thanks,
Jake.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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