• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 221
  • Last Modified:

populate 3 listboxs from 1 listbox column

excel 2010 vba

userform 4 listboxes

What I have:
I have 3 listboxes that I need populated from 1 Listbox

Listbox1
Listbox2
Listbox3

I need the listbox to contain data from Listbox4 : specifically.

Listbox1 = Listbox4.column(23)
Listbox2  = Listbox4.column(24)
Listbox3  = Listbox4.column(25)

Thanks
fordraiders
0
Fordraiders
Asked:
Fordraiders
  • 4
  • 3
1 Solution
 
Rgonzo1971Commented:
Hi,

pls try

Array1 = Application.Index(ListBox4.List, , 23)
Array2 = Application.Index(ListBox4.List, , 24)
Array3 = Application.Index(ListBox4.List, , 25)
ListBox1.List = Array1
ListBox2.List = Array2
ListBox3.List = Array3

Open in new window

Or
ListBox1.List = Application.Index(ListBox4.List, , 23)
ListBox2.List = Application.Index(ListBox4.List, , 24)
ListBox3.List = Application.Index(ListBox4.List, , 25)

Open in new window

Regards
0
 
FordraidersAuthor Commented:
type mismatch error

Array1 = Application.Index(ListBox4.List, , 23)
0
 
FordraidersAuthor Commented:
This is working but taking a very long time.
if i have alot of items in the listbox4 ?


UserForm2.ListBox4.Clear
With UserForm2.ListBox4
    For ri = .ListCount - 1 To 0 Step -1
        UserForm2.ListBox1.AddItem .List(ri, 23)
    Next
End With
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Rgonzo1971Commented:
How are

Array1,  Array2 & Array3 defined?

Are they defined like this?
Dim array1 As Variant
0
 
FordraidersAuthor Commented:
yes...
0
 
Rgonzo1971Commented:
Could you send a dummy example

I cannot reproduce the error unless the LisBox.List array has no 23rd col

Regards
0
 
FordraidersAuthor Commented:
Thanks got it to work
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now