ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combo boxes in userform auto drop down problem (https://www.excelbanter.com/excel-programming/407219-combo-boxes-userform-auto-drop-down-problem.html)

[email protected]

Combo boxes in userform auto drop down problem
 
Hi guys,

I'm using the following for a series of comboxes to display the dd
list when the combobox is selected (using tab as opposed to mouse
clicks).

Private Sub ComboBox2_Enter()
ComboBox2.DropDown
End Sub

This works fine,but only on alternate boxes! ComboBox2 works fine, 3
doesn't work, 4 does & so on.

Any ideas?

Cheers,
JF.

Jim Rech[_2_]

Combo boxes in userform auto drop down problem
 
The problem is that a combo box cannot drop down while another is in the
state. So you have to give the departing combobox a little time to close:

Assuming the userform has 4 comboboxes:

Private Sub UserForm_Initialize()
ComboBox1.List = Array("a", "b", "c")
ComboBox2.List = Array("a", "b", "c")
ComboBox3.List = Array("a", "b", "c")
ComboBox4.List = Array("a", "b", "c")
End Sub

Private Sub ComboBox1_Enter()
Set CB = ComboBox1
Application.OnTime Now, "DD"
End Sub

Private Sub ComboBox2_Enter()
Set CB = ComboBox2
Application.OnTime Now, "DD"
End Sub

Private Sub ComboBox3_Enter()
Set CB = ComboBox3
Application.OnTime Now, "DD"
End Sub

Private Sub ComboBox4_Enter()
Set CB = ComboBox4
Application.OnTime Now, "DD"
End Sub

And in a standard module:

Public CB As ComboBox

Sub DD()
CB.DropDown
End Sub



--
Jim
wrote in message
...
| Hi guys,
|
| I'm using the following for a series of comboxes to display the dd
| list when the combobox is selected (using tab as opposed to mouse
| clicks).
|
| Private Sub ComboBox2_Enter()
| ComboBox2.DropDown
| End Sub
|
| This works fine,but only on alternate boxes! ComboBox2 works fine, 3
| doesn't work, 4 does & so on.
|
| Any ideas?
|
| Cheers,
| JF.



[email protected]

Combo boxes in userform auto drop down problem
 
Cheers Jim, I'll give it a go in a bit.

On 6 Mar, 14:53, "Jim Rech" wrote:
The problem is that a combo box cannot drop down while another is in the
state. *So you have to give the departing combobox a little time to close:

Assuming the userform has 4 comboboxes:

Private Sub UserForm_Initialize()
* * ComboBox1.List = Array("a", "b", "c")
* * ComboBox2.List = Array("a", "b", "c")
* * ComboBox3.List = Array("a", "b", "c")
* * ComboBox4.List = Array("a", "b", "c")
End Sub

Private Sub ComboBox1_Enter()
* * Set CB = ComboBox1
* * Application.OnTime Now, "DD"
End Sub

Private Sub ComboBox2_Enter()
* * Set CB = ComboBox2
* * Application.OnTime Now, "DD"
End Sub

Private Sub ComboBox3_Enter()
* * Set CB = ComboBox3
* * Application.OnTime Now, "DD"
End Sub

Private Sub ComboBox4_Enter()
* * Set CB = ComboBox4
* * Application.OnTime Now, "DD"
End Sub

And in a standard module:

Public CB As ComboBox

Sub DD()
* * CB.DropDown
End Sub

--
wrote in message

...
| Hi guys,
|
| I'm using the following for a series of comboxes to display the dd
| list when the combobox is selected (using tab as opposed to mouse
| clicks).
|
| Private Sub ComboBox2_Enter()
| ComboBox2.DropDown
| End Sub
|
| This works fine,but only on alternate boxes! ComboBox2 works fine, 3
| doesn't work, 4 does & so on.
|
| Any ideas?
|
| Cheers,
| JF.



[email protected]

Combo boxes in userform auto drop down problem
 
Thanks again JR - it worked great.

Cheers,
JF


All times are GMT +1. The time now is 01:25 PM.

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