Lebaron360
New Member
- Joined
- Mar 19, 2015
- Messages
- 13
Hello all,
I am currently trying to find a way to reference data from a listbox in a userform (UserForm1) from a different worksheet. The flow of the process I am trying to accomplish should look something like this:
Book1 has a UserForm with two ListBoxes. ListBox1 is populated with data from Book1. ListBox2 is populated with items selected by the user that are moved from ListBox1.
After selecting the items for ListBox2, a new workbook is created: Book2.
In Book2, I want to loop through the items that were selected for ListBox2 and populate Book2 with data from Book1 (via VLOOKUP or some other procedure, maybe?)
I am currently trying to reference the data for ListBox2 with the following code but getting an error:
Dim ListItem As Integer
Dim CurrentManager As String
For ListItem = 1 To Workbooks("Book1.XLSM").UserForm1.ListBox2.ListCount
CurrentManager = Workbooks("Book1.XLSM").UserForm1.ListBox2.List(ListItem - 1)
Next ListItem
Thanks in advance for your help!!
I am currently trying to find a way to reference data from a listbox in a userform (UserForm1) from a different worksheet. The flow of the process I am trying to accomplish should look something like this:
Book1 has a UserForm with two ListBoxes. ListBox1 is populated with data from Book1. ListBox2 is populated with items selected by the user that are moved from ListBox1.
After selecting the items for ListBox2, a new workbook is created: Book2.
In Book2, I want to loop through the items that were selected for ListBox2 and populate Book2 with data from Book1 (via VLOOKUP or some other procedure, maybe?)
I am currently trying to reference the data for ListBox2 with the following code but getting an error:
Dim ListItem As Integer
Dim CurrentManager As String
For ListItem = 1 To Workbooks("Book1.XLSM").UserForm1.ListBox2.ListCount
CurrentManager = Workbooks("Book1.XLSM").UserForm1.ListBox2.List(ListItem - 1)
Next ListItem
Thanks in advance for your help!!