Let's say I had a combobox1, 2, 3 and a textbox1 on a userform. After update
event was associated to combobox1. When Tab key was pressed after update
event was fired (filling comboboxes 2 and 3). In the code of this event, just before exit sub there was textbox1.setfocus
to skip entering other coboboxes in the tab order (combobox 1,2,3, textbox1). It worked just fine.
When I added another combobox that is now combobox2, the tab order was changed to 1,2,3,4.
After update
is still associated to combobox1 and textbox1.setfocus is last line before exit sub. Unfortunately when exit sub line for after update
is executed, it fires combobox3 enter event
and moves focus to combobox3. It's more incomprehensible because tab order is combobox1,2,3,4 so it skips the tab order as well.
When I debuged code, the focus to textbox1 was set as it should but still just when exit sub is executed, code line is moved to combobox3 enter event... Any tips appreciated.
Application.Enableevents=False
- prevent the other events from firing. BeforeExit Sub
orEnd Sub
turn the events back on. – vacip