+ Reply to Thread
Results 1 to 4 of 4

VBA to change Array Length!

  1. #1
    Registered User
    Join Date
    10-07-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    30

    VBA to change Array Length!

    Hi guys, How can I change the array size when I want to add an element?

    Please Login or Register  to view this content.
    This code give me an error message, which is "Compile Error: Array Already Dimensioned".

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often 365, but still time to time use also older versions
    Posts
    7,858

    Re: VBA to change Array Length!

    check out this
    Please Login or Register  to view this content.
    if you just redim all previously assigned values will disappear (try to remove Preserve from second redim and check what is arrMy(1) at the end

  3. #3
    Registered User
    Join Date
    10-07-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: VBA to change Array Length!

    Its still the same, we cannot redimension the array after we already dimensioned it...

    Or anyone know how to delete the array arrMy(), so we can dimension it one more time.

  4. #4
    Registered User
    Join Date
    10-07-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    30

    Re: VBA to change Array Length!

    Sorry Kaper, your code work!

    Thanks you so much, really don't know the meaning of Dim and Redim!

    I think i have to study more about it.

+ 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. VBA variable length array help needed
    By Trinidad3 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-12-2010, 06:19 PM
  2. Max Length in Array
    By yawnzzzz in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-21-2010, 05:42 AM
  3. Length of Array question
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-24-2008, 12:24 AM
  4. [SOLVED] Modify array function length
    By Fabian Grodek in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-08-2006, 11:40 AM
  5. length of an array
    By april27 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2006, 10:10 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