?
Solved

populate 3 listboxs  from 1 listbox column

Posted on 2014-02-28
7
Medium Priority
?
217 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 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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
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!

 
LVL 52

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 52

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

765 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