View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Subtotal method of Range class failed

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.

"childofthe1980s" wrote:

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