+ Reply to Thread
Results 1 to 5 of 5

Require fields to be filled out?

  1. #1
    Registered User
    Join Date
    08-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    57

    Require fields to be filled out?

    Is there a way to make it so that a person has to fill out a field, or gets an error message if they fillout a form and leave spaces blank? I'm creating a sign-in sheet that has

    Name, Time In, Time Seen and Time Out. I want it to require or at least notify the users if they don't fill out one of the sections in a line.
    Last edited by Fcroft; 06-09-2010 at 01:18 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Require fields to be filled out?

    Sure, are you using a UserForm or is the user filling data directly onto the worksheet?

    If using a form, after clicking whatever button they push to put the data into the sheet but before actually moving the data, have excel check that each of those controls (txt or combo boxes) are not = "". If they are, show a message box telling them to fill each out and then exit sub.

    If the user is writing directly to the spreadsheet, you need something to trigger the code that checks if the line is completely filled out. Once you have that you can check that each cell has a value, and if one does not use a message box telling them to fill it out.

    If you post a sample workbook I'd be happy to put an example of the needed code in it.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    08-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: Require fields to be filled out?

    Right now it is simply in xlsx format the user types things into the sheet directly. Would it be easier to setup a user form and if so, what is a good place to read up on using them? I have used some conditional formatting that tells if the times are not within our hours of operations (ie someone putting in 1:15 am instead of pm) and there are some dropdown menus. I went ahead and turned the text to black so you will see the info for the dropdowns on the right. Normally it is white text and I hide those columns.
    Attached Files Attached Files

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Require fields to be filled out?

    The reasons I'd use a userform are:
    1) Looks cleaner / more professional.
    2) Easier trigger to make sure your whole line is filled out. As is, I can't think of how you'd make sure a whole line is filled.

    I've reposted your example with a rough userform. Check out the RowSource property of the comboboxes, and the code behind the whole form to see how it works.

    The page I found most helpful when I was creating my first forms was:
    http://www.exceltip.com/st/Create_Us...Excel/629.html

    Hope that helps!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-28-2009
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    57

    Re: Require fields to be filled out?

    Thanks a lot for the form, I'll play with it for a bit to get it to where I want, but this is a great starting point.

    *EDIT* Nevermind, I figured it out. Thanks again.
    Last edited by Fcroft; 06-09-2010 at 01:18 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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