Following code is used to set up subtotals:-
Range("A1").Select
rowcount = Selection.CurrentRegion.Rows.Count
colcount = Selection.CurrentRegion.Columns.Count
Range(Range("A1"), Range("A1").Offset(0, colcount - 1)).Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True
This sometimes, but not always, fails "Error 1004: This can't be applied to the selected range. Select a single cell in a range and try again"
If a single cell is selected, current region is assumed, so I commented out the "Range(Range("A1"), Range("A1").Offset(0, colcount - 1)).Select" line
In this case one test that had previously failed now worked; however another test still failed.
Any suggestions?
Is the intermittent failure because of the amount of data?
Thanks in anticipation
Paul
Range("A1").Select
rowcount = Selection.CurrentRegion.Rows.Count
colcount = Selection.CurrentRegion.Columns.Count
Range(Range("A1"), Range("A1").Offset(0, colcount - 1)).Select
Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True
This sometimes, but not always, fails "Error 1004: This can't be applied to the selected range. Select a single cell in a range and try again"
If a single cell is selected, current region is assumed, so I commented out the "Range(Range("A1"), Range("A1").Offset(0, colcount - 1)).Select" line
In this case one test that had previously failed now worked; however another test still failed.
Any suggestions?
Is the intermittent failure because of the amount of data?
Thanks in anticipation
Paul