Results 1 to 3 of 3

Redim array - out of range

Threaded View

  1. #1
    Registered User
    Join Date
    09-10-2014
    Location
    Matrix
    MS-Off Ver
    2010
    Posts
    70

    Redim array - out of range

    Dear all,

    I know that problem is obvious but now for me I have darkness in my mind. I try to load data from excel cells to variant array. Data is in columns A and B. My code:
    Sub RedimTbl()
      Dim tbl() As Variant
      Dim i As Integer
      
      i = 1
      Do Until Cells(i, 1) = ""
        ReDim Preserve tbl(1 To i, 1 To 2)
        tbl(i, 1) = Cells(i, 1)
        tbl(i, 2) = Cells(i, 2)
        i = i + 1
      Loop
    
    End Sub
    And unfortunately I get error 'Subscription out of range'
    Last edited by michson; 04-30-2015 at 03:35 AM.
    (*) Reputation points appreciated.
    excelbs.tk

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Subscript out of range - ReDim Preserve an array
    By dejavision in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2014, 04:29 PM
  2. [SOLVED] Redim Preserve array: subscript out of range
    By supern0va in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-02-2012, 12:58 PM
  3. redim array error....subscript out of range
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2011, 11:07 AM
  4. Assign sheet value to array... and redim the array size
    By Orange.CL in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2010, 07:18 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

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