+ Reply to Thread
Results 1 to 3 of 3

Replace a Cells contents after a value is entered

  1. #1
    Registered User
    Join Date
    05-25-2004
    Location
    Cleveland, Ohio USA
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    23

    Replace a Cells contents after a value is entered

    I have a formula that tests to see if a Date entered in a cell falls within a certain Week.

    The formula is:
    =IF(A2="","",IF(AND(A2>=(WE-6),A2<=WE),"","Invalid Date"))

    Where "WE" equals a Week Ending Date previously selected on another sheet (ie: Week Ending: Feb 9, 2008).

    If I place this formula in a cell it will put "Invalid Date" in it if I enter a date that is not within 7 days of the "WE" date in cell A2.

    My question is can I create a Macro that will put "Invalid Date" in cell A2 after the user originally enters a date in cell A2 that is not within the 7 Days of the Week Ending Date?

    I would like it to enter the "Invalid Date" text immediately and this needs to occur on several cells (ie: Range = A2:A200).

    I can't seem to create an "IF/Then" statement that will work.

    Thanks for any and all assistance.

  2. #2
    Forum Contributor
    Join Date
    10-27-2006
    Location
    United Kingdom
    MS-Off Ver
    EXCEL 2003 (2007 at home)
    Posts
    517
    My first thought was that you will have to do some fancy VBA programming.

    However, try looking into the DATA > VALIDATION options.

    This might not give exactly what you are after, but might point you in an alternative direction.
    A bit of lateral thinking might prompt the desired user response from a slightly different excel response...

    Mark.

  3. #3
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326
    Another possibility would be to use Conditional Formatting, turning the cell red if the input is not as expected;
    But teh Data - Validation looks the best to me ( without VBA of course)

+ 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