+ Reply to Thread
Results 1 to 6 of 6

Cell validation based on values

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Cell validation based on values

    Hello -

    I have a worksheet with two cells that may contain data. The first cell (A1) may only contain a whole number while the second cell (B1) can only contain a date greater than today. However, only one of these two cells may contain a value. I need a procedure that enforces this validation:


    If A1>=1, then B1 is null
    If B1>=1,then A1 is null

    Thanks for any assistance with this.

    Grilleman

  2. #2
    Forum Contributor
    Join Date
    08-27-2009
    Location
    South Africa
    MS-Off Ver
    Office 2010
    Posts
    217

    Re: Cell validation based on values

    I would leave the data in A1 & B1 and add the formulas to C1 & D1 ---
    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Cell validation based on values

    Kind of clunky, but

    Please Login or Register  to view this content.
    Perhaps it was the Noid who should have avoided me...
    If you are satisfied with my solution click the small star icon on the left. Thanks
    1. Make a copy of your workbook and run the following code on your copy (just in case)
    2. With excel open, press ALT+F11 to open the Visual Basic Editor (VBE). From the "Insert" menu, select "Module".
    3. Paste the code from above into the empty white space. Close the VBE.
    4. From the developer tab, choose "Macros", select the Sub Name, and click "Run".

  4. #4
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Re: Cell validation based on values

    So where would I insert this code... at the sheet level, the workbook level or the module level. Sorry, I's struggling to learn this.

  5. #5
    Valued Forum Contributor AlvaroSiza's Avatar
    Join Date
    09-19-2007
    Location
    Staffordshire
    MS-Off Ver
    2007
    Posts
    591

    Re: Cell validation based on values

    Sheet level.

  6. #6
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2010
    Posts
    245

    Re: Cell validation based on values

    Can't seem to get this to work quite right. With your code, when a value is entered in A1 B1 can still receive data. I want to prohibit this. Cell B1 should be locked when A1 contains data and cell A1 should be locked whenever cell B1 contains data.

+ 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