Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Synchronize data in two LISTBOXes cellist Excel Discussion (Misc queries) 1 October 12th 09 03:39 PM
Is there a way to create multiple listboxes in same collumn? Ken C[_2_] Excel Discussion (Misc queries) 0 September 25th 09 07:50 PM
start and end dates within listboxes casey Excel Worksheet Functions 4 April 16th 08 06:48 PM
ListBoxes - correct syntax Bob Phillips[_5_] Excel Programming 0 September 17th 03 02:02 PM
Listboxes get unchecked on save-as Alex[_6_] Excel Programming 0 July 25th 03 02:45 PM


All times are GMT +1. The time now is 10:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"