ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Listbox control (https://www.excelbanter.com/excel-programming/290984-listbox-control.html)

Robert Couchman[_4_]

Listbox control
 
Hello all,

please can i ask for some help,
i have tried many ways of getting two listboxes to line up
with each other, i would like to know of any code that
would allow one listbox to select the apropriate value
from an adjacent list box.
eg. one list box contacins there application numbers (only
the ones found) and the second list box displays there
names, i would like to select a name and it will select
the number next to the name aswell (these list boxes are
already lined up and will have the same number of values
in)

thank you,

Robert Couchman

Harald Staff

Listbox control
 
Hi Robert

If I understand you correct, you want like "third from the top in both".
These will synk them:

Private Sub ListBox1_Click()
If ListBox2.ListIndex < ListBox1.ListIndex Then _
ListBox2.ListIndex = ListBox1.ListIndex
End Sub

Private Sub ListBox2_Click()
If ListBox1.ListIndex < ListBox2.ListIndex Then _
ListBox1.ListIndex = ListBox2.ListIndex
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Robert Couchman" skrev i melding
...
Hello all,

please can i ask for some help,
i have tried many ways of getting two listboxes to line up
with each other, i would like to know of any code that
would allow one listbox to select the apropriate value
from an adjacent list box.
eg. one list box contacins there application numbers (only
the ones found) and the second list box displays there
names, i would like to select a name and it will select
the number next to the name aswell (these list boxes are
already lined up and will have the same number of values
in)

thank you,

Robert Couchman





All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com