ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating a ListBox with an Array (https://www.excelbanter.com/excel-programming/431911-populating-listbox-array.html)

ironhydroxide

Populating a ListBox with an Array
 
I have 2 ListBoxes on my UserForm, the ListBox1 Has a list in it
(RowSourced) and i want the Userform to Put information (a list) in ListBox2
According to what is selected in ListBox1.

I have it far enough that i can get a start cell and stop cell (in the same
column) of the information I want. This is the information i want in ListBox1

I hope i have made this clear enough

Thanks in advance
ironhydroxide

Gary Keramidas

Populating a ListBox with an Array
 
not really. but maybe this example can get you started.

Private Sub ListBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim ws As Worksheet
Dim i As Long
Set ws = Worksheets("Sheet1")
For i = 1 To 8
If Me.ListBox1.Value = "A" Then

Me.ListBox2.AddItem Worksheets("Sheet1").Range("A" & i).Value
Else
Me.ListBox2.AddItem Worksheets("Sheet1").Range("B" & i).Value
End If

Next
End Sub

--

Gary Keramidas
Excel 2003


"ironhydroxide" wrote in message
...
I have 2 ListBoxes on my UserForm, the ListBox1 Has a list in it
(RowSourced) and i want the Userform to Put information (a list) in
ListBox2
According to what is selected in ListBox1.

I have it far enough that i can get a start cell and stop cell (in the
same
column) of the information I want. This is the information i want in
ListBox1

I hope i have made this clear enough

Thanks in advance
ironhydroxide




All times are GMT +1. The time now is 07:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com