+ Reply to Thread
Results 1 to 2 of 2

Setfocus on Userform

  1. #1
    Registered User
    Join Date
    04-29-2017
    Location
    London
    MS-Off Ver
    2016 Professional
    Posts
    50

    Question Setfocus on Userform

    I have a large number of textboxes on a userform. During data entry I am performing two types of validation, validating that the text entered in every textbox is a number and then the value entered in each textbox falls within a specified range, the range for each textbox is different.

    For each textbox I have used a BeforeUpdate. The first action is to test if the value entered is a number (this is common to all textbox BeforeUpdates). If the value entered is a number the value is checked to determine if it is within the acceptable range (the range is unique for each textbox). If the value is outside the range the focus returns to the textbox ok due to the use of Cancel = True. However, if the value entered is not numeric the focus does not return. How can I ensure that focus returns to the textbox if the value is not numeric?


    Please Login or Register  to view this content.
    Last edited by rabbit_post; 04-29-2017 at 04:12 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Setfocus on Userform

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

    PS Can you please add code tags when posting code?
    If posting code please use code tags, see here.

+ 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 userform not working
    By janderson055 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-15-2017, 03:22 PM
  2. Userform setfocus does not work?
    By flabb in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2016, 07:24 AM
  3. [SOLVED] SetFocus on a Userform TextBox
    By bibu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-22-2015, 05:18 PM
  4. Excel UserForm SetFocus
    By gopal baheti in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2015, 05:42 AM
  5. 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
  6. [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
  7. question setfocus on a userform
    By GregJG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2007, 11:28 AM

Tags for this Thread

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