View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
kmbarz kmbarz is offline
external usenet poster
 
Posts: 16
Default Subtotal Column Labels error

I get the following when the below code tries to subtotal table 7:
"Microsoft Office Excel cannot determine which row in your list or selection
contains column labels, which are required for this command."

The only difference I can see on table 7 is that it has four columns where
the rest have five or more. Is there someway to tell subtotal which to use
without the manual interaction?

Thanks

If tble = 2 Or tble = 4 Or tble = 6 Or tble = 7 Then
RptEnd = 7
Do Until Range("D" & RptEnd) = ""
RptEnd = RptEnd + 1
Loop
RptEnd = RptEnd - 1
For i = 7 To RptEnd
If Range("A" & i) = "" Then
Range("A" & i) = Range("A" & i - 1)
Else
End If
Next i

Range("A6:O" & RptEnd).Select
Application.CutCopyMode = False
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(4), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True