+ Reply to Thread
Results 1 to 5 of 5

dynamic array causes an error.

  1. #1
    Registered User
    Join Date
    02-01-2012
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    45

    dynamic array causes an error.

    I have a macro of which does what I need, however I don't always know what size array could be needed.
    I am trying to change my array to dynamic but this causes an error.

    My best knowlage to do this is to change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    BUT DOING THIS FAILS... Why?
    My Code
    Please Login or Register  to view this content.
    Help would be really appreciated.
    Thanks.
    Last edited by Solidstan; 01-15-2015 at 04:23 PM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: dynamic array causes an error.

    You need to redim and preserve the existing array when you add to it.

  3. #3
    Registered User
    Join Date
    02-01-2012
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: dynamic array causes an error.

    Ok thanks, I have seen redim and preserve on google, but where ever I put it this line still fails.
    Please Login or Register  to view this content.
    Any help where and how I would put redim preserve?
    Thanks.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: dynamic array causes an error.

    This should help you.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-01-2012
    Location
    Wales
    MS-Off Ver
    Excel 2007
    Posts
    45

    Re: dynamic array causes an error.

    ahah, looks a lot cleaner than my code..
    Thanks, I'll give this ago tommorrow.

+ 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. Loop new messages containing a table, populate a dynamic array, paste array to Excel
    By laripa in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 05-19-2013, 07:20 AM
  2. [SOLVED] Populate Listbox with all rows of a dynamic array where elements of a single array match.
    By Tayque_J_Holmes in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 08-07-2012, 04:54 AM
  3. dynamic array redim preserve: run-time error 9, Subscript out of range.
    By Broesel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-20-2009, 08:39 AM
  4. Runtime error '9'. Subscripts out of range - Dynamic array
    By akabraha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-23-2007, 05:38 PM
  5. [SOLVED] Subscript out range error when redimensioning dynamic array
    By Crazy Cat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2006, 02:30 AM

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