Subtotal problem; Asks for label row.


Posted by Beginner Box on March 08, 2001 2:25 PM

Me again,

I have the following section of code for subtotalling info in a sheet:

On Error Resume Next
Set ND = WS.Range("A65536").End(xlUp).Offset(0, 15)
Range("A3", ND).Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(4, 5, 6, 7, _
8, 10, 11, 13, 15), Replace:=True, PageBreaks:=False, SummaryBelowData:= _
True

The problem is, it notifies me every time that it can't find the row labels, and press OK if the first row in selected range includes them. I press OK and it subtotals correctly. How do I tell it to use the first row every time so I won't see this box? Thanks for any help in advance.

Posted by Dave Hawley on March 08, 2001 3:05 PM


Hi Bob

I assume your Column headings are numeric or not bolded maybe ?

Anyway As the default for this message is "OK" try this:


On Error Resume Next
Set ND = WS.Range("A65536").End(xlUp).Offset(0, 15)
Application.DisplayAlerts = False
Range("A3", ND).Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(4, 5, 6, 7, _
8, 10, 11, 13, 15), Replace:=True, PageBreaks:=False, SummaryBelowData:= _
True
Application.DisplayAlerts = True


Dave

OzGrid Business Applications



Posted by Beginner Bob on March 09, 2001 10:08 AM

Thanks again Dave.

Dave