+ Reply to Thread
Results 1 to 5 of 5

Ensure mandatory fields inputted by the user

Hybrid View

abhi_jain80 Ensure mandatory fields... 04-17-2021, 06:22 PM
hrlngrv Re: Ensure mandatory fields... 04-17-2021, 07:01 PM
torachan Re: Ensure mandatory fields... 04-18-2021, 02:17 AM
kvsrinivasamurthy Re: Ensure mandatory fields... 04-18-2021, 03:43 AM
abhi_jain80 Re: Ensure mandatory fields... 04-18-2021, 05:12 PM
  1. #1
    Registered User
    Join Date
    08-10-2016
    Location
    Ireland
    MS-Off Ver
    2013
    Posts
    67

    Ensure mandatory fields inputted by the user

    Hi folks,

    The sample data with the vba code is attached.

    I need on click of the button in the "Results" tab, I should get an error if all the mandatory fields (marked with *) are not inputted by A/B/C and get the notification like...all the mandatory fields are not inputted by A or B or C, if 2 will not input...it should be like...all the mandatory fields are not inputted by A and B. These mandatory fields are dynamic in nature.

    Hope I am clear with the requirement. I am novice to macros, hence thought of reaching out to experts community.

    Thanks in advance...
    Abhi
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Ensure mandatory fields inputted by the user

    The most direct way to force users to make valid entries is to use formulas to check for valid entries. If all entries are made and valid, such formulas return 0; otherwise, they return an error value. If such formula were in cell X99, often convenient to have another formula in Y99: =IF(COUNT(X99),"",X99). Then all other formulas which should return numbers would include +$X$99 at the end, and all formulas which should return text would include &$Y$99 at the end. That means all formulas would display errors unless all entries were made and valid.

  3. #3
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,410

    Re: Ensure mandatory fields inputted by the user

    Cleanest way is to use a UserForm as an interface to the sheet - all data handling can be checked before entry to the sheet.
    Simplify the data storage to one sheet - if this involves data storage of many inquiries - unique identifier is needed and the format would be simpler in table form transposed to that shown.
    torachan.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Ensure mandatory fields inputted by the user

    Add this code (Red Font ) to the existing code.
            Set Rc = Nothing
    For Each cel In Range("E8:E29")
    If InStr(1, cel, "*") > 0 And cel.Offset(0, 1) = "" Then
    MsgBox ("Please fill all mandatory fields")
    Exit For
    End If
    Next cel
    
    End Sub
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  5. #5
    Registered User
    Join Date
    08-10-2016
    Location
    Ireland
    MS-Off Ver
    2013
    Posts
    67

    Re: Ensure mandatory fields inputted by the user

    Perfect. Got you...Thanks

+ 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. VBA Macros to force user to fill all the mandatory fields
    By Abdur_rahman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2018, 11:09 AM
  2. Replies: 1
    Last Post: 12-01-2017, 08:34 AM
  3. [SOLVED] How to use validation in excel to ensure the data inputted is workday
    By wowow in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-16-2015, 12:33 AM
  4. Mandatory field required message when user skips mandatory fields
    By Bharathi27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2013, 05:12 AM
  5. Mandatory Fields
    By i82 in forum Excel General
    Replies: 1
    Last Post: 09-13-2012, 05:13 AM
  6. Mandatory fields
    By Konstantinos in forum Excel General
    Replies: 2
    Last Post: 03-22-2007, 09:29 AM
  7. Mandatory Fields
    By Libby in forum Excel General
    Replies: 0
    Last Post: 01-19-2005, 06:11 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