Results 1 to 4 of 4

erase an array resulting in array not populated when the macro runs again

Threaded View

  1. #1
    Forum Contributor aprildu's Avatar
    Join Date
    04-13-2014
    Location
    Barrie,On, Canada
    MS-Off Ver
    Excel 2016
    Posts
    175

    erase an array resulting in array not populated when the macro runs again

    I have a two dimentional array that's redim preserved:

    sub test()
    
    dim ar()
    
    x=0
    Do
    x=x+1
    redim preserve ar (1 to 5, 1 to x)
    ar(1,x)=**
    ar(2,x)=***
    ...
    loop while ****
    
    sheet1.range("a1:f" & x)=application.worksheetfunction.transpose(ar)
    erase ar()
    end sub
    If I don't have "erase ar()" line then if I run a few times (consecutively) then I get the same array stacked multiple times. If I have that line then I don't get any results (if I run multiple times - the first time is OK)

    If I don't run it consecutively then there's no issue. Just wondering why and if it's OK to run multiple times(in case client does it even there's no reason to run multiple times). Any insight is appreciated!
    Last edited by aprildu; 06-14-2019 at 03:00 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Counting Unique values with date criteria as an array formula resulting in #N/A
    By Clooney003 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-22-2019, 12:51 PM
  2. Looking up the lowest populated value in an array
    By jamot in forum Excel General
    Replies: 3
    Last Post: 07-29-2016, 08:37 AM
  3. Comparing a string to values in an array resulting in a Run time Error 1004
    By sgreni in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-15-2009, 04:21 PM
  4. Array Value populated from cell A2:A38
    By Chris Baluyot in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2008, 02:04 AM
  5. [SOLVED] Positioning Numeric Values Resulting from 6 Column Array Formula
    By Sam via OfficeKB.com in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-05-2006, 12:25 PM
  6. [SOLVED] Positioning Numeric Values Resulting from 6 Column Array Formula
    By Sam via OfficeKB.com in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-04-2006, 10:10 PM

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