+ Reply to Thread
Results 1 to 3 of 3

Userform setfocus does not work?

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    37

    Userform setfocus does not work?

    Hi.
    I have a userform with 4 inputboxes. For one of them I want to compare the input to a range. This works. Then I have a loop that says if the input is not among the values (text and number) in the range, a variable gets a number. This works. If the input is not in the range, a message box says that the input does not exist, and returns to the userform. This works. BUT here is the strange part; I then want the .setfocus to be in the same textbox, but this does not happen? The next textbox is highlighted...I've tried several solutions, but can't fint the one???!!!

    Here are the full codes to the userform;
    Explanations:
    formMastnummer is the textbox I'm talking about.
    formFriksjonsvinkel_en is another textbox
    formGrunnvannstand_en is another textbox
    formOppfylling_en is another textbox
    Beregningsinput_en is the userform.

    I copied all the codes, maybe some of the other codes interfere with the one I want to work.

    As you can see, I have setfocus in the same if sentence as the msgbox, (marked with <----- below), but .setfocus does not work, while the msgbox does...?

    (Btw: no error code are displayed)

    Please Login or Register  to view this content.

    Thanks in advance!!!

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Userform setfocus does not work?

    You do not need .SetFocus, you must only add
    Please Login or Register  to view this content.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Registered User
    Join Date
    05-22-2014
    Posts
    37

    Re: Userform setfocus does not work?

    Are you kidding me...that easy!

    THANKS!!!!!! saved my day!!

+ 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] SetFocus on a Userform TextBox
    By bibu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2015, 05:18 PM
  2. Excel UserForm SetFocus
    By gopal baheti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2015, 05:42 AM
  3. Multiple .SetFocus in UserForm does not work
    By Faridwahidi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-04-2014, 10:21 PM
  4. [SOLVED] SetFocus to another tab on a multi tab userform
    By abordeau in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2014, 01:08 PM
  5. SetFocus doesn't work properly on a Userform on ComboBoxes and TextBoxes
    By pimre in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-15-2013, 03:15 PM
  6. question setfocus on a userform
    By GregJG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2007, 11:28 AM
  7. [SOLVED] setfocus does not work as expected
    By wgoldfarb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-17-2005, 03:06 AM

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