Results 1 to 7 of 7

Force SetFocus until input has been made

Threaded View

  1. #1
    Forum Contributor onmyway's Avatar
    Join Date
    09-03-2012
    Location
    Johannesburg, South Africa
    MS-Off Ver
    2013
    Posts
    386

    Force SetFocus until input has been made

    Hi guys,

    I have this code that checks that my TextBox is not empty, and also formats it. But when one tabs through the field, a warning does pop up, but the cursor moves to the next field. How can I change/force the focus to that field until an input has been made?

    i have tried SetFocus

    Here is my code:

    Private Sub txtStockSOS1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    
        If Not IsNumeric(txtStockSOS1.Value) And txtStockSOS1.Value <> vbNullString Then
    
            MsgBox "Sorry, only numbers allowed"
           
            txtStockSOS1.Value = vbNullString
            
            'Me.txtStockSOS1.SetFocus
            
        Else
    txtStockSOS1.Value = Format(txtStockSOS1.Value, "#,##0.00")
        End If
        
    End Sub
    Thank you!
    Last edited by onmyway; 01-30-2015 at 03:04 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Retain Formula when Input is made
    By drakaz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-11-2013, 10:03 AM
  2. Force data input style
    By Armitage2k in forum Excel General
    Replies: 1
    Last Post: 04-22-2012, 06:33 AM
  3. Getting macro to return input made into input box
    By MrPoesiat in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-13-2012, 04:09 PM
  4. Replies: 1
    Last Post: 08-02-2011, 11:48 AM
  5. force input data to be uppercase
    By 435 Gavea in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-16-2007, 10:13 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