PDA

View Full Version : ListBox1 populates Listbox2 upon selection from a sheet?



melgibson2
09-12-2010, 10:17 AM
Hi. I have 2 listboxes, and several textboxes.

listCustomer holds the list of customers;
listRefNo holds the list of reference numbers attached to the customers;
the various textboxes hold all the data from the corresponding record in excel (date, amount and so on, not important).

Each customer may have more than 1 record/ref number attached to their name.

Excel is setup with Customers in column A, Ref No in column B, and the various pieces of data in C, D, E and so on.

When I click the customer's name in listCustomer, I need listRefNo to populate with only that selected customer's reference numbers. Then, when the user clicks one of those reference numbers, the textboxes fill with the various data from the other columns in the same row as that reference number.

I've been searching the forums for a solution but there are a lot of topics on listboxes and I'm dredging through them, so I apologise if it's been asked before and I haven't seen it.

Thanks guys.

Simon Lloyd
09-12-2010, 10:47 AM
Without a sample workbook all we can say is use a variable and then combobox1. additem(variable)

melgibson2
09-12-2010, 10:48 AM
Without a sample workbook all we can say is use a variable and then combobox1. additem(variable)

Okay I'll make a mockup

melgibson2
09-12-2010, 11:10 AM
Hi Simon, I uploaded a sample spreadsheet with the basic data layout and a basic picture of the userform below:

http://imgur.com/jEINI.png

Simon Lloyd
09-12-2010, 02:08 PM
Post closed for abuse in other forum areas! user banned.