1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: excel userform

Discussion in 'Business Applications' started by scouse13, Jan 25, 2011.

Thread Status:
Not open for further replies.
  1. scouse13

    scouse13 Thread Starter

    Joined:
    Oct 29, 2009
    Messages:
    137
    Hi all

    i have set up a userform which has 6 input boxes requiring users to enter text data in 5 of the boxes and numerical data in 1 box, having done this they then press the continue button which transfers the inputted data to another worksheet, this all works fine, but what i would like is when the continue button is pressed to have some code that checks all the input boxes have data entered in them if not an error message to appear, asking the user to input data in the missing box

    any ideas please
     
  2. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,912
    Post your existing code or even better your sample workbook.

    Rollin
     
  3. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,597
    First Name:
    Hans
    If your userform has an OK button and an action that is triggered to this you can add a asimple function which returns either True or False for the check to save and close the form

    Something like
    Code:
    Private Function TestData() as Boolean
    Dim isOk as Boolean
    isOk = True
    If me.yourvalue1.value = vbnullstring then isok = false
    if me.yourvalue2.value = vbnullstring then isok = false
    if  me.yourvalue3.value = vbnullstring then isok = false
    if me.yourvalue4.value = vbnullstring then isok = false
    if not isnumeric(me.yournumeric.value ) then iso of = false
    Testdata = isok
    end Function
    
    
    The code above is not tested just typed in, no scheck for syntax etc. just to show the idea

    So you exit procedure will test
    ....
    if testdata = false then
    exit sub
    endif

    the rest of your code to save and close the form
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/976844

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice