Results 1 to 13 of 13

Cancel Data Entry if text box is blank

Threaded View

  1. #1
    Registered User
    Join Date
    06-08-2015
    Location
    Glasgow
    MS-Off Ver
    2010
    Posts
    21

    Cancel Data Entry if text box is blank

    I apologise if this is a repost but I have been searching for a while and cannot find a solution to my problem

    I have created a userform in which there is a combo box and several text boxes these boxes input data into corresponding cells depending on the option selected in the combo box

    the problem I have is that when a text box is blank the data is still input into the spreadsheet leaving that cell blank

    I wish to write into the code that if a text box is blank the data entry is cancelled, focus is set onto that box and an error box comes up
    I have included my code below to show what I have at the moment

    error in message box
    If txtNo.Value = "" Then
    MsgBox "You must input a drawing number"
    txtNo.SetFocus
    End If
    'clear input controls.
    Me.txtNo.Value = ""
    'set focus on drawing box
    txtNo.SetFocus
    End Sub
    Last edited by SeanBaird; 06-10-2015 at 03:07 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 02-04-2014, 12:36 AM
  2. [SOLVED] IF data on opened worksheet has blank data then cancel macro and move onto next part
    By jonathan.haynes in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2013, 07:11 AM
  3. Replies: 2
    Last Post: 09-18-2008, 05:47 AM
  4. data validation drop-down menu blank entry
    By crapit in forum Excel General
    Replies: 2
    Last Post: 12-14-2005, 09:25 AM
  5. data entry to next blank TextBox
    By csellens22@msn.com in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-17-2005, 06: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