Solved

populate 3 listboxs  from 1 listbox column

Posted on 2014-02-28
7
215 Views
Last Modified: 2014-03-06
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
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39896939
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
 
LVL 3

Author Comment

by:fordraiders
ID: 39899722
type mismatch error

Array1 = Application.Index(ListBox4.List, , 23)
0
 
LVL 3

Author Comment

by:fordraiders
ID: 39899748
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
Independent Software Vendors: 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!

 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39899763
How are

Array1,  Array2 & Array3 defined?

Are they defined like this?
Dim array1 As Variant
0
 
LVL 3

Author Comment

by:fordraiders
ID: 39899775
yes...
0
 
LVL 51

Expert Comment

by:Rgonzo1971
ID: 39899799
Could you send a dummy example

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

Regards
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 39909331
Thanks got it to work
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question