ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Down button goes past bottom of combobox list to next object. (https://www.excelbanter.com/excel-programming/409315-down-button-goes-past-bottom-combobox-list-next-object.html)

[email protected]

Down button goes past bottom of combobox list to next object.
 
Hi guys,

Here's something strange I can't figure out...

I have a userform with multiple comboboxes & command buttons. Using
the down arrow to pick from the dd list of any of the comboboxes is
fine, but if I keep pressing down at the bottom of a list the object
underneath the active object is selected - I had expected the last
item in the list to still be selected!

Anyone make any sense of this & know how to stop it happening?

Cheers,
JF.

Nigel[_2_]

Down button goes past bottom of combobox list to next object.
 
It does and I am not sure why, but one my get around is to add a blank item
to the combobox then monitor the combobox for changes and force it to scroll
to top of list when it reaches the end.........you will need to add same
code for each offending box, or probably all of them to make the interface
consistent. Not too elegant but it works.

Private Sub ComboBox1_Change()
With ComboBox1
If .ListIndex = .ListCount - 1 Then .ListIndex = 0
End With
End Sub

--

Regards,
Nigel




wrote in message
...
Hi guys,

Here's something strange I can't figure out...

I have a userform with multiple comboboxes & command buttons. Using
the down arrow to pick from the dd list of any of the comboboxes is
fine, but if I keep pressing down at the bottom of a list the object
underneath the active object is selected - I had expected the last
item in the list to still be selected!

Anyone make any sense of this & know how to stop it happening?

Cheers,
JF.



[email protected]

Down button goes past bottom of combobox list to next object.
 
Thanks for the speedy response Nigel.

That works great; I altered it a little to make it stop at the bottom
of the list:
If .ListIndex = .ListCount - 1 Then .ListIndex = .ListIndex - 1

Thanks for your help.

Cheers,
JF.

On Apr 14, 12:29*pm, "Nigel" wrote:
It does and I am not sure why, but one my get around is to add a blank item
to the combobox then monitor the combobox for changes and force it to scroll
to top of list when it reaches the end.........you will need to add same
code for each offending box, or probably all of them to make the interface
consistent. *Not too elegant but it works.

Private Sub ComboBox1_Change()
*With ComboBox1
* If .ListIndex = .ListCount - 1 Then .ListIndex = 0
*End With
End Sub

--

Regards,
Nigel


wrote in message

...



Hi guys,


Here's something strange I can't figure out...


I have a userform with multiple comboboxes & command buttons. Using
the down arrow to pick from the dd list of any of the comboboxes is
fine, but if I keep pressing down at the bottom of a list the object
underneath the active object is selected - I had expected the last
item in the list to still be selected!


Anyone make any sense of this & know how to stop it happening?


Cheers,
JF.- Hide quoted text -


- Show quoted text -




All times are GMT +1. The time now is 02:04 PM.

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