VBA excel combobox.dropdown method only woks with every other box -


i have form 3 comboboxes. when run wish able cycle through them using tab key , when each box has focus list drop down automatically (so don't have press down arrow).

in form code have following

private sub combobox1_enter() combobox1.dropdown end sub 

with same combobox 2 & 3

however work every other box. on initial run, combobox1 has focus - no drop down appears. press tab & combobox2 gets focus , dropdown appears. press again cpmbobox3 gets focus - no dropdown.

press again combobox1 takes focus again , dropdown list apears , on, if click on box, list dropdown.

if put object such text box in between each combobox dropdown method work each combobox.

any 1 ideas why dropdown method won't work consecutive comboboxes when using tab?

yes happens because tabing interferes normal functioning. try (tried , tested)

logic: capture tab key (keycode: 9) , set 0 , move next combo using code.

code:

option explicit  dim long  '~~> adding sample data private sub userform_initialize()     = 1 10         combobox1.additem i: combobox2.additem i: combobox3.additem     next     combobox1.dropdown end sub  private sub combobox1_keydown(byval keycode msforms.returninteger, _ byval shift integer)     if keycode = 9         keycode = 0         combobox2.setfocus         combobox2.dropdown     end if end sub  private sub combobox2_keydown(byval keycode msforms.returninteger, _ byval shift integer)     if keycode = 9         keycode = 0         combobox3.setfocus         combobox3.dropdown     end if end sub  private sub combobox3_keydown(byval keycode msforms.returninteger, _ byval shift integer)     if keycode = 9         keycode = 0         combobox1.setfocus         combobox1.dropdown     end if end sub 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -