Subtotal method of Range class failed

C

childofthe1980s

Hello:

In a simple macro that I created, I have the following:

Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(12), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True

Although this macro ran fine for days without error, all of a sudden, it is
giving me the "Subtotal method of Range class failed" error when I run it
today. (Must be a Monday...)

How do I fix this? It's Office 2007. Also, how do I save the fix? Every
time I try to make changes to the VBA Editor and save, it seems like it wants
to save a new doc. All I want to do is make the change (the fix), save the
change in the same macro file, and be done.

childofthe1980s
 
J

Joel

I susspect you selection changes each day which is cuaing the problem. check
the range that is being selected. Then validatate this is the problem by
trying the same subtotal by going to the worksheet and using Data - Subtotals.

To validate the selection you can add a break ppoint on the line you have
posted by clicking with the mouse on the line and then Pressing F9. the line
should change color. Then execute the macro like you would normally do. the
code will stop executing on the highlighted line. then go to the worksheet
and see which area is highlighted. Also check that the Selection contains 12
items.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top