LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Continue to have issue with array in Subtotals automation

Hi all,

I had posted on this issue previously, but was not able to find a solution
from those who provided input. Below is a better description of what I'm
trying to do and the issue I'm having:

I am trying to get the code to subtotal beginning with column BA and going
through the last column to the right (the number of columns to the right of
BA can vary). The subtotal needs to be based on changes in column A (ie -
subtotal for "Bob", then for "Mary", etc) -- the headers are in row 2 and the
data to be summed begins with row 3 (after a blank row 3 is deleted by one of
the first lines in the code). The line of code below noted by ** results in
the following error:

Error:
Run-time error '1004': Subtotal method of Range class failed

Sub subtotalcum()

Dim aryCols() As Variant
Dim i As Integer
Dim max As Integer

Dim rng As Range

With Sheets("Commission by Entity breakdown")

.Rows("3:3").Delete shift:=xlUp

On Error Resume Next
Set rng = .Range(.Range("BA2"),
..Range("IV2").End(xlToLeft).Offset(0, -8))
max = rng.Count
ReDim aryCols(1 To max)
On Error GoTo 0
If Not rng Is Nothing Then

For i = 1 To max
aryCols(i) = i + 52
Next i

.Range("A2").subtotal _
GroupBy:=1, _
Function:=xlSum, _
TotalList:=aryCols(), _
Replace:=True, _
PageBreaks:=False, _
SummaryBelowData:=False
End If
End With

End Sub
--
Robert
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Automation : numbers Copy/Paste issue from VB6 [email protected] Excel Programming 6 July 7th 06 09:18 AM
Automation issue Dimmer Excel Discussion (Misc queries) 1 June 30th 05 11:38 AM
Excel Automation Issue Matthew Wieder Excel Programming 4 September 8th 03 06:26 AM
inexperienced header entry automation resizing/scaling issue(s) D Franseen Excel Programming 0 July 9th 03 06:08 AM


All times are GMT +1. The time now is 05:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"