Solved

populate 3 listboxs  from 1 listbox column

Posted on 2014-02-28
7
214 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 50

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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 50

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 50

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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 Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

726 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