Hi I am fairly new to excel and I am having trouble trying to get a sub total function to work for me. I need the subtotal to for a list of about 20 columns in one line with a varying amount of rows. So the subtotal must stop when there is a blank at the top. I can get the macro to find the totals A on the spreadsheet and then offset to beneath the columns of numbers but the sub total formulas takes in every number. I'm hoping somone can help. Here is the example:
[TABLE="width: 355"]
<TBODY>[TR]
[TD][TABLE="width: 285"]
<TBODY>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456.00</SPAN>[/TD]
[TD="align: right"]8,798.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]45,465.00</SPAN>[/TD]
[TD="align: right"]789,789.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]45,465.00</SPAN>[/TD]
[TD="align: right"]789,789.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[TD="align: right"]7,897.00</SPAN>[/TD]
[/TR]
[TR]
[TD]Totals A</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456,465.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456,465.00</SPAN>[/TD]
[TD="align: right"]1,231.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]5,465.00</SPAN>[/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]4,546.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD]Totals B</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456,465.00</SPAN>[/TD]
[TD="align: right"]1,231.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]5,465.00</SPAN>[/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]4,546.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]48,654.00</SPAN>[/TD]
[TD="align: right"]7,987.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]546.00</SPAN>[/TD]
[TD="align: right"]89.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456.00</SPAN>[/TD]
[TD="align: right"]899.00</SPAN>[/TD]
[/TR]
[TR]
[TD]Totals C</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL></COLGROUP>[/TABLE]
[/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD]</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL></COLGROUP>[/TABLE]
[TABLE="width: 355"]
<TBODY>[TR]
[TD][TABLE="width: 285"]
<TBODY>[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456.00</SPAN>[/TD]
[TD="align: right"]8,798.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]45,465.00</SPAN>[/TD]
[TD="align: right"]789,789.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]45,465.00</SPAN>[/TD]
[TD="align: right"]789,789.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[TD="align: right"]7,897.00</SPAN>[/TD]
[/TR]
[TR]
[TD]Totals A</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456,465.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456,465.00</SPAN>[/TD]
[TD="align: right"]1,231.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]5,465.00</SPAN>[/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]4,546.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD]Totals B</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456,465.00</SPAN>[/TD]
[TD="align: right"]1,231.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]5,465.00</SPAN>[/TD]
[TD="align: right"]56,456.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]4,546.00</SPAN>[/TD]
[TD="align: right"]45,646.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]48,654.00</SPAN>[/TD]
[TD="align: right"]7,987.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]546.00</SPAN>[/TD]
[TD="align: right"]89.00</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]456.00</SPAN>[/TD]
[TD="align: right"]899.00</SPAN>[/TD]
[/TR]
[TR]
[TD]Totals C</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL></COLGROUP>[/TABLE]
[/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD]</SPAN>[/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"][/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="align: right"]</SPAN>[/TD]
[TD="align: right"]</SPAN>[/TD]
[/TR]
[TR]
[TD][/TD]
[TD] [/TD]
[TD] [/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL></COLGROUP>[/TABLE]