+ Reply to Thread
Results 1 to 2 of 2

SetFocus not working

  1. #1
    Registered User
    Join Date
    09-08-2012
    Location
    uk
    MS-Off Ver
    Excel 2016
    Posts
    6

    SetFocus not working

    I have a multi-page form with multiple text boxes and a routine triggered when one of the text boxes (Phi_1_TextBox) is updated.

    If the value entered into Phi_1_TextBox is less than a variable defined by an equation then it launches a message box to let the user know and then sets the value of the text box to equal that variable.

    The problem I am having is setting the focus back to Phi_1_TextBox afterwards. Instead (on pressing enter) it jumps to the next text box, or whichever other text box I click on.

    How do I keep the focus on Phi_1_TextBox?

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: SetFocus not working

    Try using the Exit event instead. I am not quite sure why AfterUpdate isn't working but I suspect that the event is allowed to occur after the Sub finishes, which takes it back out of focus.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] TextBox4.SetFocus Not Working
    By Logit in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-20-2019, 08:37 PM
  2. [SOLVED] Setfocus is not working after find.
    By OM1950 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-10-2014, 06:33 PM
  3. Setfocus not working
    By Cbrehm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2011, 02:55 PM
  4. .SetFocus Not working properly
    By Tirren in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-16-2008, 05:26 PM
  5. trying to SetFocus not working
    By bhofsetz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2008, 05:50 PM
  6. TextBox.SetFocus not working
    By vesoljc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2007, 01:49 AM
  7. SetFocus not working
    By Henry T in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2005, 01:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1