+ Reply to Thread
Results 1 to 6 of 6

Won't Add Multicolumn Data

  1. #1
    Brandon Johnson
    Guest

    Won't Add Multicolumn Data

    I jsut need to be able to add these values to the listbox. I have 13
    columns and is set to 75 pt column width.

    lstResults.AddItem A(1) & ";" & A(2) & ";" & A(3) & ";" & A(4) & ";" &
    A(5) & ";" & A(6) & ";" & A(7) & ";" & A(8) & ";" & A(9) & ";" & A(10)
    & ";" & A(11) & ";" & A(12) & ";" & A(13)


  2. #2
    Brandon Johnson
    Guest

    Re: Won't Add Multicolumn Data

    It lists all the data in the first cell

    Brandon Johnson wrote:
    > I jsut need to be able to add these values to the listbox. I have 13
    > columns and is set to 75 pt column width.
    >
    > lstResults.AddItem A(1) & ";" & A(2) & ";" & A(3) & ";" & A(4) & ";" &
    > A(5) & ";" & A(6) & ";" & A(7) & ";" & A(8) & ";" & A(9) & ";" & A(10)
    > & ";" & A(11) & ";" & A(12) & ";" & A(13)



  3. #3
    Tom Ogilvy
    Guest

    Re: Won't Add Multicolumn Data

    With lstResults
    .AddItem A(1)
    for j = 2 to 13
    .List(.Listcount-1,j - 1) = A(j)
    Next
    end With

    --
    Regards,
    Tom Ogilvy


    "Brandon Johnson" wrote:

    > It lists all the data in the first cell
    >
    > Brandon Johnson wrote:
    > > I jsut need to be able to add these values to the listbox. I have 13
    > > columns and is set to 75 pt column width.
    > >
    > > lstResults.AddItem A(1) & ";" & A(2) & ";" & A(3) & ";" & A(4) & ";" &
    > > A(5) & ";" & A(6) & ";" & A(7) & ";" & A(8) & ";" & A(9) & ";" & A(10)
    > > & ";" & A(11) & ";" & A(12) & ";" & A(13)

    >
    >


  4. #4
    Brandon Johnson
    Guest

    Re: Won't Add Multicolumn Data

    thanks for the reply. however it throws me a runtime 381 error when it
    trys to fire off the .list property. any thoughts?

    Tom Ogilvy wrote:
    > With lstResults
    > .AddItem A(1)
    > for j = 2 to 13
    > .List(.Listcount-1,j - 1) = A(j)
    > Next
    > end With
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Brandon Johnson" wrote:
    >
    > > It lists all the data in the first cell
    > >
    > > Brandon Johnson wrote:
    > > > I jsut need to be able to add these values to the listbox. I have 13
    > > > columns and is set to 75 pt column width.
    > > >
    > > > lstResults.AddItem A(1) & ";" & A(2) & ";" & A(3) & ";" & A(4) & ";" &
    > > > A(5) & ";" & A(6) & ";" & A(7) & ";" & A(8) & ";" & A(9) & ";" & A(10)
    > > > & ";" & A(11) & ";" & A(12) & ";" & A(13)

    > >
    > >



  5. #5
    Tom Ogilvy
    Guest

    Re: Won't Add Multicolumn Data

    My oversight, the method I suggested only works for up to 10 columns:

    Private Sub UserForm_Initialize()
    Dim a(1 To 10) As Long
    With lstResult
    .ColumnCount = 10
    .ColumnWidths = "75;75;75;75;75;75;75;75;75;75;75;75;75"
    For i = 1 To 25 ' 25 rows
    For j = 1 To 10 ' 10 columns
    ' populate the array with dummy values
    ' for testing
    a(j) = Int(Rnd() * 100 + 1)
    Next
    .AddItem a(i)
    For j = 2 To 10
    .List(.ListCount - 1, j - 1) = a(j)
    Next
    Next
    End With
    End Sub

    For 13 columns, you will need to populate your data like this:

    Private Sub UserForm_Initialize()
    Dim a(1 To 25, 1 To 13) As Long
    With lstResult
    .ColumnCount = 13
    .ColumnWidths = "75;75;75;75;75;75;75;75;75;75;75;75;75"
    For i = 1 To 25 ' 25 rows
    For j = 1 To 13 ' 13 columns
    a(i, j) = Int(Rnd() * 100 + 1)
    Next
    Next
    ' assign the 25 x 13 array to list all at once
    .List = a
    End With
    End Sub


    --
    Regards,
    Tom Ogilvy

    "Brandon Johnson" wrote:

    > thanks for the reply. however it throws me a runtime 381 error when it
    > trys to fire off the .list property. any thoughts?
    >
    > Tom Ogilvy wrote:
    > > With lstResults
    > > .AddItem A(1)
    > > for j = 2 to 13
    > > .List(.Listcount-1,j - 1) = A(j)
    > > Next
    > > end With
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "Brandon Johnson" wrote:
    > >
    > > > It lists all the data in the first cell
    > > >
    > > > Brandon Johnson wrote:
    > > > > I jsut need to be able to add these values to the listbox. I have 13
    > > > > columns and is set to 75 pt column width.
    > > > >
    > > > > lstResults.AddItem A(1) & ";" & A(2) & ";" & A(3) & ";" & A(4) & ";" &
    > > > > A(5) & ";" & A(6) & ";" & A(7) & ";" & A(8) & ";" & A(9) & ";" & A(10)
    > > > > & ";" & A(11) & ";" & A(12) & ";" & A(13)
    > > >
    > > >

    >
    >


  6. #6
    Dave Peterson
    Guest

    Re: Won't Add Multicolumn Data

    I've never had to use a listbox with that many columns.

    But I always believed help:

    Setting ColumnCount to 0 displays zero columns, and setting it to -1 displays
    all the available columns. For an unbound data source, there is a 10-column
    limit (0 to 9).

    Thanks for shaking my beliefs once more <vbg>.



    Tom Ogilvy wrote:
    >
    > My oversight, the method I suggested only works for up to 10 columns:
    >
    > Private Sub UserForm_Initialize()
    > Dim a(1 To 10) As Long
    > With lstResult
    > .ColumnCount = 10
    > .ColumnWidths = "75;75;75;75;75;75;75;75;75;75;75;75;75"
    > For i = 1 To 25 ' 25 rows
    > For j = 1 To 10 ' 10 columns
    > ' populate the array with dummy values
    > ' for testing
    > a(j) = Int(Rnd() * 100 + 1)
    > Next
    > .AddItem a(i)
    > For j = 2 To 10
    > .List(.ListCount - 1, j - 1) = a(j)
    > Next
    > Next
    > End With
    > End Sub
    >
    > For 13 columns, you will need to populate your data like this:
    >
    > Private Sub UserForm_Initialize()
    > Dim a(1 To 25, 1 To 13) As Long
    > With lstResult
    > .ColumnCount = 13
    > .ColumnWidths = "75;75;75;75;75;75;75;75;75;75;75;75;75"
    > For i = 1 To 25 ' 25 rows
    > For j = 1 To 13 ' 13 columns
    > a(i, j) = Int(Rnd() * 100 + 1)
    > Next
    > Next
    > ' assign the 25 x 13 array to list all at once
    > .List = a
    > End With
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    > "Brandon Johnson" wrote:
    >
    > > thanks for the reply. however it throws me a runtime 381 error when it
    > > trys to fire off the .list property. any thoughts?
    > >
    > > Tom Ogilvy wrote:
    > > > With lstResults
    > > > .AddItem A(1)
    > > > for j = 2 to 13
    > > > .List(.Listcount-1,j - 1) = A(j)
    > > > Next
    > > > end With
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > > "Brandon Johnson" wrote:
    > > >
    > > > > It lists all the data in the first cell
    > > > >
    > > > > Brandon Johnson wrote:
    > > > > > I jsut need to be able to add these values to the listbox. I have 13
    > > > > > columns and is set to 75 pt column width.
    > > > > >
    > > > > > lstResults.AddItem A(1) & ";" & A(2) & ";" & A(3) & ";" & A(4) & ";" &
    > > > > > A(5) & ";" & A(6) & ";" & A(7) & ";" & A(8) & ";" & A(9) & ";" & A(10)
    > > > > > & ";" & A(11) & ";" & A(12) & ";" & A(13)
    > > > >
    > > > >

    > >
    > >


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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