Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multicolumn combobox Gromit Excel Programming 2 January 23rd 06 04:14 PM
Multicolumn listbox data display jbl25[_9_] Excel Programming 0 September 20th 05 03:56 AM
MultiColumn ComboBox Paul Smith[_3_] Excel Programming 2 August 3rd 05 06:36 AM
Display multicolumn box Alen32 Excel Programming 6 March 13th 05 12:02 PM
display multicolumn box Alen32 Excel Programming 1 March 12th 05 05:00 PM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"