I'm getting a Subtotal method of Range class failed Error when I try to run a macro in Excel 2007. Code works GREAT (no errors) when I run it using Excel 2003.

Here's a snippet...

'SubTotal Sheet
    Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4, 5, 6, 7, _
        8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True

Any help would be appreciated.


I recorded a macro in 2007 to see if there was any difference in the code and it's basically the same as what you have above. Could it be that the table has moved? A1 should be the top left of the range you want to subtotal. Are there breaks in the data? This could cause issues. Is the data properly sorted?

What errors are you getting in Excel 2007 when you run this code?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.