+ Reply to Thread
Results 1 to 3 of 3

SetFocus not re-directing cursor to propr textbox

  1. #1
    Forum Contributor
    Join Date
    04-02-2013
    Location
    Hollywood, Fl
    MS-Off Ver
    Excel 2010
    Posts
    110

    SetFocus not re-directing cursor to propr textbox

    I've set a validation within my userform to force the user to enter in a valid employee ID or a general kiosk #. The validation is working, but the setFocus line I have added to place the cursor back in the textbox in the event the value entered was incorrect isn't working. The cursor is moving on to the next textbox making the user have to re-click on the text box in order to correct the invalid entry. Am I placing my setFocus line in the wrong place of the code? FYI - The second setFocus is working correctly. When the user enters 9999 it directs them to the IT Ticket number text box. Prior to me moving the textbox, the cursor would jump all other text boxes to allow the user to enter in a ticket number within the ticket number box after entering 9999 within the PERNR text box. Any ideas????

    Please Login or Register  to view this content.
    Damian37

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: SetFocus not re-directing cursor to propr textbox

    Use the Exit event instead of AfterUpdate and then use
    Please Login or Register  to view this content.
    instead of:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: SetFocus not re-directing cursor to propr textbox

    You are putting the logic for the 2 so you'll need to separate your IF one for each, so if A is blank A set focus, if B is blank B set focus

    SORRY IGNORE ME :o)
    Last edited by nathansav; 06-18-2014 at 10:12 AM.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

+ 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. VBA Setfocus to next textbox
    By pjbassdc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-07-2013, 12:47 PM
  2. TextBox.SetFocus not working
    By vesoljc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-11-2007, 01:49 AM
  3. [SOLVED] Having problems with textbox setfocus
    By Terry K in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2006, 09:30 AM
  4. setfocus in textbox on multipage
    By Martin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-06-2006, 12:25 AM
  5. [SOLVED] SetFocus does not show cursor in initialize (Excel VBA)
    By Tamara Plute in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-27-2005, 12:06 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