+ Reply to Thread
Results 1 to 5 of 5

Redim preserve throws error

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Redim preserve throws error

    I am trying to remove all rows from the array if certain cells are empty with
    Please Login or Register  to view this content.
    I get the correct range if I post back the newr array to a sheet

    But I in tring to redim newArr to the proper size I get Script out of range and the Redim is hightlited

    Can't figure out what is wrong, newArr has the correct dim

    Thanks

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Redim preserve throws error

    I keep trying to upload a file but is not working

  3. #3
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Redim preserve throws error

    here is the file
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Redim preserve throws error

    As explained in the help file for the ReDim statement: https://msdn.microsoft.com/VBA/Langu...edim-statement
    Quote Originally Posted by VBA help
    If you use the Preserve keyword, you can resize only the last array dimension and you can't change the number of dimensions at all.
    It appears that your code is trying to redim both dimensions.

    If I follow your code correctly, it looks like you are only redimming the first dimension. If that is the case, then you can probably "transpose" the array so that the changing dimension is the second dimension.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Re: Redim preserve throws error

    Thank you, that got me there
    Please Login or Register  to view this content.

+ 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. [SOLVED] redim preserve issue
    By Tayque_J_Holmes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-24-2017, 09:39 AM
  2. [SOLVED] Redim Preserve gives me a Run-Time Error 9. Subscript out of range. Why.
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2016, 01:40 PM
  3. [SOLVED] ReDim Preserve problem
    By randomdude in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-25-2014, 05:40 AM
  4. redim preserve error
    By ggabi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-08-2012, 03:00 AM
  5. 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
  6. Redim Preserve 2D Array
    By kraljb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-12-2006, 03:23 PM
  7. [SOLVED] redim preserve
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-15-2005, 09:45 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