ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   ActiveX combobox (https://www.excelbanter.com/excel-worksheet-functions/199892-activex-combobox.html)

aqualibra

ActiveX combobox
 
I am using activeX to create both my combobox and buttons. I have 2
comboboxes. Combobox11 is dependent on combobox10. My program is as follows:

Sub Combobox10_enter()
Me.ComboBox10.Clear
Me.ComboBox10.AddItem (Sheets("Input").Range("M57"))
Me.ComboBox10.AddItem (Sheets("Input").Range("M58"))
Me.ComboBox10.AddItem (Sheets("Input").Range("M59"))
Me.ComboBox10.AddItem (Sheets("Input").Range("M60"))
End Sub

Sub Combobox11_enter()
If Me.ComboBox10 = Range("M60") Then
Me.ComboBox11.Clear
Me.ComboBox11.AddItem (Sheets("Input").[N59])
Else
Me.ComboBox11.Clear
Me.ComboBox11.AddItem (Sheets("Input").Range("N57"))
Me.ComboBox11.AddItem (Sheets("Input").Range("N58"))
End If
End Sub

Is there a way such that when I make changes to combobox10, combobox11
automatically gets reset. Right now it still shows the last option selected.
Thanks.


Héctor Miguel

ActiveX combobox
 
hi, !

it's not so clear what you really try to do @ enter into combobox11 -?-

try adding a line with ComboBox11.Clear in your ComboBox10_Change event -?-

hth,
hector.

__ OP __
I am using activeX to create both my combobox and buttons.
I have 2 comboboxes. Combobox11 is dependent on combobox10. My program is as follows:

Sub Combobox10_enter()
Me.ComboBox10.Clear
Me.ComboBox10.AddItem (Sheets("Input").Range("M57"))
Me.ComboBox10.AddItem (Sheets("Input").Range("M58"))
Me.ComboBox10.AddItem (Sheets("Input").Range("M59"))
Me.ComboBox10.AddItem (Sheets("Input").Range("M60"))
End Sub

Sub Combobox11_enter()
If Me.ComboBox10 = Range("M60") Then
Me.ComboBox11.Clear
Me.ComboBox11.AddItem (Sheets("Input").[N59])
Else
Me.ComboBox11.Clear
Me.ComboBox11.AddItem (Sheets("Input").Range("N57"))
Me.ComboBox11.AddItem (Sheets("Input").Range("N58"))
End If
End Sub

Is there a way such that when I make changes to combobox10, combobox11 automatically gets reset.
Right now it still shows the last option selected.





All times are GMT +1. The time now is 06:24 PM.

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