![]() |
Linked ListBoxes
Hello,
Got a small question. Can two listboxes be linked so that when a selection is made in one listbox, the selection in the other is autmatically updated ? Description : I use a form in an Excel sheet to do some reporting over our cars and their drivers, on the inputform there are two listboxes LB1 with a list of cars and LB2 with a list of drivers. The purpose is to be able to select either the car or the driver, if one does not know which driver corresponds with which car. So, if a car is selected in LB1 the value of LB2 has to change to the corresponding driver. Otherwise, if a driver is selected in LB2 the value of LB1 has to change to the corresponding car. To avoid mistakes I also want to lock the second listbox after a selection is made. So if a selection is made in LB1, then LB2 has to be locked and vice versa. I'm trying for this to work through the Listbox Change event but I get all kind of error messages. I'm sure it has to be something simple and I'm just looking over it. I hope someone can help me with this ? Thanks in advance ! Phill |
Linked ListBoxes
Just assign the appropriate rowsource/listfillrange of the second (or first)
LB in the click event of the first (or second). You need to check if the other LB is already set or use a public boolean variable, checked and set by these events to prevent recursive execution of the events. -- Regards, Tom Ogilvy "Phill" wrote in message ... Hello, Got a small question. Can two listboxes be linked so that when a selection is made in one listbox, the selection in the other is autmatically updated ? Description : I use a form in an Excel sheet to do some reporting over our cars and their drivers, on the inputform there are two listboxes LB1 with a list of cars and LB2 with a list of drivers. The purpose is to be able to select either the car or the driver, if one does not know which driver corresponds with which car. So, if a car is selected in LB1 the value of LB2 has to change to the corresponding driver. Otherwise, if a driver is selected in LB2 the value of LB1 has to change to the corresponding car. To avoid mistakes I also want to lock the second listbox after a selection is made. So if a selection is made in LB1, then LB2 has to be locked and vice versa. I'm trying for this to work through the Listbox Change event but I get all kind of error messages. I'm sure it has to be something simple and I'm just looking over it. I hope someone can help me with this ? Thanks in advance ! Phill |
All times are GMT +1. The time now is 12:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com