vba - How to control the interlinked comboBoxes output? -


i have 2 comboboxes in userform.

the first combox- combobox1 updated items userform initialized, below.

private sub userform_initialize()     combobox1         .additem "a"         .additem "b"     end end sub 

now once value of comboxbox1 selected, updates second combobox - combobox2, below -

private sub combobox1_change()         combobox2         .clear         .additem "p"         .additem "q"         .additem "r"     end end sub 

and combobox2 on change displays current value -

private sub combobox2_change()     msgbox combobox2.value end sub 

now when select value combobox1 first time, combobox2 updated , further on selecting value combbox2, popup message combobox2 value --- this fine.

now again select different value combobox1, time blank popup message, (because cleared combobox2 content).

how can handle this, don't want msgbox popup on changing combobox1, want popup on manually selecting values combobox2?

this happening because once combobox2 has value , change combobox1 (and .clear combobox2 - changes combobox2. use combobox2 -

private sub combobox2_change() if combobox2.listcount = 0 exit sub     msgbox combobox2.value end sub 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -