+ Reply to Thread
Results 1 to 8 of 8

Conditional Mandatory Entry - If one, all three

  1. #1
    Registered User
    Join Date
    06-24-2010
    Location
    Battle Creek, MI
    MS-Off Ver
    Excel 2007
    Posts
    84

    Conditional Mandatory Entry - If one, all three

    On a particular spreadsheet I have 3 columns (let's say columns A, B & C) where if a value is entered in any of A1, B1, or C1, I would like to 'Error Alert' if any of the values in A1, B1, or C1 is left blank/unfilled.

    Any thoughts are appreciated.

    Thanks, Dan
    Last edited by DJBittner; 11-14-2011 at 11:51 AM. Reason: not getting there

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,176

    Re: Conditional Mandatory Entry - If one, all three

    You'd have to use a VBA Worksheet Change Event to monitor the three cells. As you can only key into one cell at a time, when do you want to issue a warning?

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    06-24-2010
    Location
    Battle Creek, MI
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Conditional Mandatory Entry - If one, all three

    Good point -- I would probably want to trigger the alert after the 3rd column is entered or skipped.

    With that said, does anyone have an example of a VBA Change Event (trigger?) example for field (multiple field) editing?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,176

    Re: Conditional Mandatory Entry - If one, all three

    This might work if the cell movement is to the right:

    Please Login or Register  to view this content.

    However, if you enter two values and cursor down, it wouldn't fire unless you went back to the row after column 3.

    Regards

  5. #5
    Registered User
    Join Date
    06-24-2010
    Location
    Battle Creek, MI
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Conditional Mandatory Entry - If one, all three

    I tried to simplify my example using the first 3 columns when, in fact, my application is using columns 18,19, 20, and 21.

    And here is where the plot thickens: everything to the right of column 21 (column U) is protected so the cursor jumps to column 1 (column A) after column 21 (column U) is entered. Manipulating the gifted (and appreciated) code yields either an error msg after the first column is entered, without ability to move to the following (related) fields/columns OR I get no error at all.

  6. #6
    Registered User
    Join Date
    06-24-2010
    Location
    Battle Creek, MI
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Conditional Mandatory Entry - If one, all three

    In the spirit of trying, I commented out my VBA code and added this to the Data Validation formula line for the cells involved in the range of columns & rows -
    =AND(COUNTA($R$9:$R19)=ROW()-2,COUNTA($U$9:$U19)=ROW()-2)
    This method wants to work -- however, I get a warning after I enter a value into a column and before I can key into the next column.

    So VBA vs. Data Validation?

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Conditional Mandatory Entry - If one, all three

    Hello DJBittner,

    I think this is issue can best be resolved by you posting the workbook for review.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  8. #8
    Registered User
    Join Date
    06-24-2010
    Location
    Battle Creek, MI
    MS-Off Ver
    Excel 2007
    Posts
    84

    Re: Conditional Mandatory Entry - If one, all three

    Ok, I have attached my workbook Tables.xlsm. Worksheet TED is my Time-Entry application and the columns I am trying validate are the Materials columns, R, S, T, & U.

    As I tried to state previously is that for those 4 columns, if data is entered in any of the columns, then all of the other 3 column values are required.

    btw, there is a macro Unprotect, to edit the protected worksheet, "...for just such emergencies." (~foghorn leghorn)

    Thanks again, Dan
    Attached Files Attached Files

+ 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