I'm trying to do the same thing. I have 300 tabs to calculate subtotals on and about 1,000 rows of data on each tab. I have a macro that will calculate subtotals on the first tab and then switch to the next, calculate subtotals on it and so on, through all 300 tabs.
here is the subtotals code that I'm using:
Selection.Subtotal GroupBy:=?1, Function:=xlSum, TotalList:=Array(?2), SummaryBelowData:=True, Replace:=True
Where ?1 is the column that you want to base the subtotals on and ?2 represents the column of data that you want to sum up.
For example, if you columns are:
Date Account# Vendor Amount
and you want to calculate subtotals for "Amount" at each change in "Account#", then ?1 would be 2, and ?2 would be 4.
Make sense?
The problem that I'm having with subtotals is that the format that Excel applies to them is ugly. I'm sending these out as reports to executives and I would like to "dress them up" a little to make them more visually appealing. I need some code that will, after calculating the subtotals, insert another 2 blank rows below each subtotal line to further separate one group from another. Additionally, I need each subtotal line to be in bold and highlighted in light yellow.
The macro needs to look through each row, and if a row has subtotals on it, insert a few rows below it and apply the formats. How can I tell Excel to "identify" rows with subtotals so that it can make the changes?
I think this is in line with what Tyone is trying to accomplish.
I hope this helps and if someone can advise me I would really appreciate it.
Thanks,
Cory