Userform Textbox Focus

NickRed18

Board Regular
Joined
May 25, 2017
Messages
76
Re: Userform Textbox Focus - Driving me crazy!

I see what you're saying about the Return key being pressed twice, but just for clarification: The only items on the userform are the Textbox (ScanInput), and two buttons (AddNewItem and RemoveItem). The AddNewItem button is the one "stealing" the focus away after entering in my data into the textbox.
 
Last edited:

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
34,531
Office Version
365, 2019, 2016, 2010
Platform
Windows, MacOS
Re: Userform Textbox Focus - Driving me crazy!

Think of it as a timing issue. The pressing the enter key down initiates your code which sets focus (although the focus hasn't actually left at that point) then when you release the key, focus shifts to the next control.
 

Forum statistics

Threads
1,085,367
Messages
5,383,209
Members
401,818
Latest member
MrMisster

Some videos you may like

This Week's Hot Topics

Top