Results 1 to 8 of 8

Thread: Solved: Add array items to multi column ListBox

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,285
    Location
    There isn't a row 0 (zero) in excel. They start at 1.[vba]
    Dim x As Long
    Dim R As long
    Dim Pos as long
    Dim myArray()
    x = Sheets("Records").Range("A" & rows.count).End(xlUp).Row
    'because you start at 0 in the array the no of rows aren't
    'equal to no of rows in array. since x is the no of times the loop
    'will be executed.
    'position in sheet
    x = x - 1
    ReDim myArray(x, 3)
    pos = 1
    With Sheets("Records")

    For R = 0 To x
    myArray(R, 0) = .Range("A" & pos)
    myArray(R, 1) = .Range("D" & pos)
    myArray(R, 2) = .Range("G" & pos)
    pos = pos+1
    Next R
    End With

    [/vba]


    Last edited by Charlize; 06-28-2007 at 11:48 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •