I'm no Excel VBA expert, so the code that does this is very long, and not very pretty to be honest, but it takes data that is pages and pages long and summarises it. Not pretty, but all works, and the code wouldn't make sense without the original txt file that it pulls the data.
This last bit is a separate issue and a stand alone bit of code would hopefully just insert to the end of the macros.
I basically have 6 columns. A is a sample name. B-G are results, but there maybe more than 5 results, so it effectively wraps it underneath. Like below. This is only for 3 samples, and a few elements though, it could be many more samples and elements analysed, hence why I I would like to put a page break in at a blank point that is above the natural page break, not every blank.
[TABLE="width: 469"]
<colgroup><col><col span="5"></colgroup><tbody>[TR]
[TD][/TD]
[TD]Ba2304[/TD]
[TD]Ba2304-2[/TD]
[TD]Ba2335[/TD]
[TD]Ba2335-2[/TD]
[TD]Ba4130[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[/TR]
[TR]
[TD]Wash[/TD]
[TD="align: right"]-0.0268[/TD]
[TD="align: right"]-0.0269[/TD]
[TD="align: right"]-0.0269[/TD]
[TD="align: right"]-0.0265[/TD]
[TD="align: right"]-0.0296[/TD]
[/TR]
[TR]
[TD]B1[/TD]
[TD="align: right"]17.54[/TD]
[TD="align: right"]17.54[/TD]
[TD="align: right"]17.54[/TD]
[TD="align: right"]17.46[/TD]
[TD="align: right"]17.69[/TD]
[/TR]
[TR]
[TD]B2[/TD]
[TD="align: right"]2.019[/TD]
[TD="align: right"]1.979[/TD]
[TD="align: right"]1.995[/TD]
[TD="align: right"]1.986[/TD]
[TD="align: right"]2.022[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Ba4130-2[/TD]
[TD]S_1807[/TD]
[TD]S_1807-2[/TD]
[TD]S_1820[/TD]
[TD]S_1820-2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[/TR]
[TR]
[TD]Wash[/TD]
[TD="align: right"]-0.0515[/TD]
[TD="align: right"]-84.63[/TD]
[TD="align: right"]-81.02[/TD]
[TD="align: right"]-82.18[/TD]
[TD="align: right"]-80.59[/TD]
[/TR]
[TR]
[TD]B1[/TD]
[TD="align: right"]17.6[/TD]
[TD="align: right"]25.92[/TD]
[TD="align: right"]26.23[/TD]
[TD="align: right"]25.6[/TD]
[TD="align: right"]25.55[/TD]
[/TR]
[TR]
[TD]B2[/TD]
[TD="align: right"]1.936[/TD]
[TD="align: right"]3.533[/TD]
[TD="align: right"]1.438[/TD]
[TD="align: right"]3.125[/TD]
[TD="align: right"]1.127[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]S_1826[/TD]
[TD]S_1826-2[/TD]
[TD]Sr3380[/TD]
[TD]Sr3380-2[/TD]
[TD]Sr3464[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[TD]ppm[/TD]
[/TR]
[TR]
[TD]Wash[/TD]
[TD="align: right"]-79.82[/TD]
[TD="align: right"]-80.1[/TD]
[TD="align: right"]-0.0011[/TD]
[TD="align: right"]-0.0004[/TD]
[TD="align: right"]-0.0013[/TD]
[/TR]
[TR]
[TD]B1[/TD]
[TD="align: right"]25.61[/TD]
[TD="align: right"]25.66[/TD]
[TD="align: right"]17.6[/TD]
[TD="align: right"]17.36[/TD]
[TD="align: right"]17.51[/TD]
[/TR]
[TR]
[TD]B2[/TD]
[TD="align: right"]3.315[/TD]
[TD="align: right"]1.366[/TD]
[TD="align: right"]1.986[/TD]
[TD="align: right"]1.936[/TD]
[TD="align: right"]1.995[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Sr3464-2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ppm[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Wash[/TD]
[TD="align: right"]-0.0007[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B1[/TD]
[TD="align: right"]17.52[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]B2[/TD]
[TD="align: right"]1.945[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]