+ Reply to Thread
Results 1 to 10 of 10

Verify Form Fields, Message if error, Email if no errors

  1. #1
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Verify Form Fields, Message if error, Email if no errors

    Hello Everyone,
    I am looking for code that will verify the date in a certain field is valid. (i.e. nobody uses 99-99-9999) then check the next field that contains a range of checklists that cannot contain blanks. If a blank is discovered then a message pops up stating "Tasks in the checklist are blank. Please complete entire list." and ends the all macros. If all blanks are filled then it will call an email macro that I've already created. The problems I've encountered is that it has to loop through all cells in a range to check for blanks, send the error message AND call the email macro if there aren't any errors. My code seems to call the email macro even if there are errors and it creates several emails.

    I haven't been able to find a good way to check the date and have tried several combinations for the other but below are a couple of samples of what I've created.
    Sample 1
    Please Login or Register  to view this content.
    Sample 2
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Verify Form Fields, Message if error, Email if no errors

    This is challenging to answer in a short and concise manner. Essentially both of your samples have the potential to call the Mail_Form macro multiple times along with other issues. If you are wanting to call the macro one time only if there are no blank cells in the defined range "Form_Task" this will serve you well:

    Please Login or Register  to view this content.
    If you are happy with my response please click the * in the lower left of my post.

  3. #3
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Verify Form Fields, Message if error, Email if no errors

    Quote Originally Posted by stnkynts View Post
    This is challenging to answer in a short and concise manner. Essentially both of your samples have the potential to call the Mail_Form macro multiple times along with other issues. If you are wanting to call the macro one time only if there are no blank cells in the defined range "Form_Task" this will serve you well:

    Please Login or Register  to view this content.
    What about the message if there are blanks discovered? That is where I'm encountering the problem. Blanks = Message and stop macro, No blanks = call email macro.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Verify Form Fields, Message if error, Email if no errors

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Verify Form Fields, Message if error, Email if no errors

    This one sent the email even though there were blanks in the named range.

  6. #6
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Verify Form Fields, Message if error, Email if no errors

    Let's say 1 = check for blanks 2 = call email macro.
    if it finds blanks then it stops step one. If every cell is filled then go to step 2.

  7. #7
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Verify Form Fields, Message if error, Email if no errors

    This one sent the email even though there were blanks in the named range
    It shouldn't have. There is a key piece of information that you have not told us. Submit your workbook.

  8. #8
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Verify Form Fields, Message if error, Email if no errors

    Workbook Attached - I need it to check cells B25 to B77 named range "Form_Task". If there are blanks then end the macro and show message to complete the checklist. If there are no blanks then call the email macro.Checklist - Sample.xlsb

  9. #9
    Registered User
    Join Date
    09-05-2012
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2013
    Posts
    71

    Re: Verify Form Fields, Message if error, Email if no errors

    Finally figured it out. Had to go with code below.
    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Verify Form Fields, Message if error, Email if no errors

    Your blanks weren't blank. They have lower case "x" in them and the font was changed to white to make them look blank

+ 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. UserForm Error Message with Comments for Multiple Errors
    By Chaba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2014, 02:54 PM
  2. Replies: 0
    Last Post: 10-09-2014, 03:00 PM
  3. Use a Form Control Button to Verify Data & Display Message Box
    By thunder_279 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2014, 01:43 PM
  4. User Form Date fields error out
    By Turtle2 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 06-21-2013, 09:17 PM
  5. Replies: 1
    Last Post: 01-22-2010, 03:57 PM
  6. Why the Form is not viewable in email message
    By jesika in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2009, 03:03 AM
  7. Replies: 0
    Last Post: 10-17-2005, 04:05 PM

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