Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Listbox in a form

Is there a restriction on how many colums you can display.
I manage to display only up to 10, even after changing the BoundColumn and
BoundCount property to 17.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Listbox in a form

Hi,

It depends how you are populating the listbox.

Using additem the limit is 9
Using RowSource 256
Using variant array unlimited

The draw back of the Rowsource is you can not change the listbox entry
directly. Instead you change the linked cell.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Dan" wrote in message
...
Is there a restriction on how many colums you can display.
I manage to display only up to 10, even after changing the BoundColumn and
BoundCount property to 17.


  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Listbox in a form

Thank you very much,
How do I use variant array?

"Andy Pope" wrote:

Hi,

It depends how you are populating the listbox.

Using additem the limit is 9
Using RowSource 256
Using variant array unlimited

The draw back of the Rowsource is you can not change the listbox entry
directly. Instead you change the linked cell.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Dan" wrote in message
...
Is there a restriction on how many colums you can display.
I manage to display only up to 10, even after changing the BoundColumn and
BoundCount property to 17.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Listbox in a form

Hi,

Firstly a correction. With additems you get 10 columns, as you stated.

On a blank worksheet put this formula in A1

A1: =ADDRESS(ROW(),COLUMN())

Fill the formula across range A1:IV10

Now create a userform with 3 listboxes and 1 commandbutton.
Paste the following code.

Private Sub CommandButton1_Click()

Dim lngCol As Long
Dim lngRow As Long
Dim vntData As Variant

With Range("A1:IV10")
' 256 columns
ListBox1.ColumnCount = .Columns.Count
ListBox1.RowSource = .Address

' 256 columns form variant array
vntData = .Value
ListBox2.ColumnCount = .Columns.Count
ListBox2.List = vntData

' additem approach
On Error GoTo ErrAddColumn
For lngCol = 1 To .Columns.Count
ListBox3.ColumnCount = lngCol
For lngRow = 1 To .Rows.Count
If lngCol = 1 Then
ListBox3.AddItem .Cells(lngRow, lngCol)
Else
ListBox3.List(lngRow - 1, lngCol - 1) = _
Cells(lngRow, lngCol)
End If
Next
Next
End With
ErrAddColumn:
Exit Sub

End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Dan" wrote in message
...
Thank you very much,
How do I use variant array?

"Andy Pope" wrote:

Hi,

It depends how you are populating the listbox.

Using additem the limit is 9
Using RowSource 256
Using variant array unlimited

The draw back of the Rowsource is you can not change the listbox entry
directly. Instead you change the linked cell.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Dan" wrote in message
...
Is there a restriction on how many colums you can display.
I manage to display only up to 10, even after changing the BoundColumn
and
BoundCount property to 17.



  #5   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default Listbox in a form

Many Thanks

"Andy Pope" wrote:

Hi,

Firstly a correction. With additems you get 10 columns, as you stated.

On a blank worksheet put this formula in A1

A1: =ADDRESS(ROW(),COLUMN())

Fill the formula across range A1:IV10

Now create a userform with 3 listboxes and 1 commandbutton.
Paste the following code.

Private Sub CommandButton1_Click()

Dim lngCol As Long
Dim lngRow As Long
Dim vntData As Variant

With Range("A1:IV10")
' 256 columns
ListBox1.ColumnCount = .Columns.Count
ListBox1.RowSource = .Address

' 256 columns form variant array
vntData = .Value
ListBox2.ColumnCount = .Columns.Count
ListBox2.List = vntData

' additem approach
On Error GoTo ErrAddColumn
For lngCol = 1 To .Columns.Count
ListBox3.ColumnCount = lngCol
For lngRow = 1 To .Rows.Count
If lngCol = 1 Then
ListBox3.AddItem .Cells(lngRow, lngCol)
Else
ListBox3.List(lngRow - 1, lngCol - 1) = _
Cells(lngRow, lngCol)
End If
Next
Next
End With
ErrAddColumn:
Exit Sub

End Sub

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Dan" wrote in message
...
Thank you very much,
How do I use variant array?

"Andy Pope" wrote:

Hi,

It depends how you are populating the listbox.

Using additem the limit is 9
Using RowSource 256
Using variant array unlimited

The draw back of the Rowsource is you can not change the listbox entry
directly. Instead you change the linked cell.

Cheers
Andy

--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"Dan" wrote in message
...
Is there a restriction on how many colums you can display.
I manage to display only up to 10, even after changing the BoundColumn
and
BoundCount property to 17.



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
Possible to Filter a Listbox on a form? skuzapo Excel Programming 5 March 9th 06 07:30 PM
Refrence to Listbox in form rash Excel Programming 2 January 11th 06 02:40 PM
listbox value to a form alexanderd[_11_] Excel Programming 1 July 17th 05 04:24 PM
vb6 form with listbox RB Smissaert Excel Programming 2 June 2nd 05 11:23 PM
User form with a listbox John Green[_2_] Excel Programming 4 December 30th 03 07:18 PM


All times are GMT +1. The time now is 11:12 AM.

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

About Us

"It's about Microsoft Excel"