+ Reply to Thread
Results 1 to 7 of 7

how can i write a code to stop leaving blank textbox in userform

  1. #1
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    how can i write a code to stop leaving blank textbox in userform

    in my userform i have three textboxes(1,2,3) and a button

    i want the user must enter something in it

    if u leave blank it should display an msg that u must enter an message in it

    Please Login or Register  to view this content.

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

    Re: how can i write a code to stop leaving blank textbox in userform

    Please Login or Register  to view this content.
    Without sounding odd, did you even google how to check a textboxes contents, or validating textboxes in VBA?
    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

  3. #3
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: how can i write a code to stop leaving blank textbox in userform

    i have used this but still having same problem

    it just login please let me know where i was doing the wrong

    Please Login or Register  to view this content.
    Last edited by baig123; 09-02-2014 at 07:51 AM. Reason: paragraph

  4. #4
    Registered User
    Join Date
    08-27-2014
    Location
    Albany, NY
    MS-Off Ver
    Office 2010
    Posts
    91

    Re: how can i write a code to stop leaving blank textbox in userform

    It appears you have put the if statement in a place where it says IF blank THEN do these things. You should test each box for a blank before you move on. Something like an "event on exit"ing the textbox

    Please Login or Register  to view this content.
    Hopefully this sheds some light on it.

  5. #5
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: how can i write a code to stop leaving blank textbox in userform

    i have three textboxes

    i tried but have put this code in each an textbox in my userform but still having the same

    whenever i submit it should display that u should enter the textboxes after that it need to submit

    i have attached my sheet
    Attached Files Attached Files
    Last edited by baig123; 09-03-2014 at 01:35 AM. Reason: paragraph

  6. #6
    Registered User
    Join Date
    04-24-2013
    Location
    Finland
    MS-Off Ver
    Excel 2010
    Posts
    57

    Re: how can i write a code to stop leaving blank textbox in userform

    Why don't you just disable your Submit-button and enable it after each of those three fields have values? It would be much nicer to see your code if it wasn't password protected.

  7. #7
    Forum Contributor
    Join Date
    03-01-2014
    Location
    Mysore
    MS-Off Ver
    Excel 2007
    Posts
    379

    Re: how can i write a code to stop leaving blank textbox in userform

    Thanks for sharing ur knowledge

+ 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. Replies: 4
    Last Post: 01-29-2014, 05:53 AM
  2. block user from using same information in textbox or leaving it blank in UserForm
    By david1987 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2013, 11:57 AM
  3. [SOLVED] Type mismatch on a date textbox when leaving it blank
    By shardin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-26-2012, 05:25 AM
  4. Userform - Stop Command button working if a textbox is blank?
    By revenge4ash89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2012, 05:52 AM
  5. Code To Check blank textbox in userform with yes no msgbox
    By jwala in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-01-2010, 05:32 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