Sometimes it is useful to highlight a selected item in a combo box or a text box for easy text replacing.
First of all, as many developers know, when you want to get into a form changing the active control and highlighting it, you simply can write:
However, inside a userform edition, when you click in a text box control, the content does not get highlighted. On the other hand, if you get into the control using tabs, the current content it is highlighted by default.
The solution for click event is not use the Enter event, but the MouseDown event:
It works for Combo Boxes and Text Boxes.
Most believe that Enter event would work on that situation, but it doesn't, because the Enter event change the active control for the destination but not completely. It runs before MouseDown event, therefore before the mouse click action and its consequences.
Besides, I have not found any reference that the above trick works well also for combo boxes. It is cool because a user can type just the initials for fast selection, without manually erase the current item.
Version: Excel 2003 to Excel 2010
Bookmarks