+ Reply to Thread
Results 1 to 4 of 4

Dynamic array will not pass through to the 'TotalList' parameter in my subtotal routine

  1. #1
    Registered User
    Join Date
    01-01-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010, 2013, 2016
    Posts
    35

    Question Dynamic array will not pass through to the 'TotalList' parameter in my subtotal routine

    Hi all,

    Thanks for any helped provided - I tried to find a resolve to this online before posting. Here is the issue:

    I want to pass through myArr to the 'TotalList' parameter of the subtotal routine. I have created the array using a for loop which results in the Array (3,4,5,6), which is correct for what I need. However when I run the sub below I get the error message: "Subtotal Method of Range Class Failed".

    Any ideas as to what I am doing wrong?


    Please Login or Register  to view this content.
    Last edited by James McEwan; 07-22-2020 at 12:26 PM. Reason: Title error

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,726

    Re: Dynamic array will not pass through to the 'TotalList' parameter in my subtotal routin

    Looks like you'd have blank array element at end (Ubound(myArr)).

    That's probably causing the issue.

    Change your ReDim line to...

    Please Login or Register  to view this content.
    “Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.”
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    01-01-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010, 2013, 2016
    Posts
    35

    Re: Dynamic array will not pass through to the 'TotalList' parameter in my subtotal routin

    Quote Originally Posted by CK76 View Post
    Looks like you'd have blank array element at end (Ubound(myArr)).

    That's probably causing the issue.

    Change your ReDim line to...

    Please Login or Register  to view this content.

    This worked great! Thanks for this - I will mark as solved. I assume I was forgetting the that the myArr index size was (0,1,2,3,4) when what I needed was (0,1,2,3)?

    Again thanks!

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,726

    Re: Dynamic array will not pass through to the 'TotalList' parameter in my subtotal routin

    You are welcome and thanks for the rep

    I assume I was forgetting...?
    Correct.

    Redim myArr(4) is equivalent of Redim myArr(0 to 4). Size = 5.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. pass array or list to sub routine
    By tim_p in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-11-2020, 06:45 AM
  2. [SOLVED] Is possible pass array to function Filter mach parameter?
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-29-2020, 01:19 PM
  3. [SOLVED] How to set the SubTotal TotalList using a variant instead of an array
    By Davidmack in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-05-2016, 01:29 AM
  4. Replies: 2
    Last Post: 10-06-2014, 08:15 AM
  5. Replies: 0
    Last Post: 10-06-2014, 07:35 AM
  6. Pass a variable from one sub-routine to another sub-routine
    By gowtham_pec in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-01-2013, 07:07 PM
  7. SOS-How to pass array parameter to Workbooks.OpenText(...) in VC++
    By Lily in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-17-2010, 04:28 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1