+ Reply to Thread
Results 1 to 7 of 7

Date not found in range?

  1. #1
    Forum Contributor
    Join Date
    03-07-2013
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    274

    Date not found in range?

    Hello folks,

    Upon a Worksheet_SelectionChange() event, a date is inputed in current cell "E2" and has a date of 11/02/2019.

    So, I type in the date and when I press enter, the Worksheet_SelectionChange() event is fired.

    please see code below:

    Please Login or Register  to view this content.
    A couple of cells within the range E2 to E306 have the same date in them : 11/02/2019.

    But the the Value not found message always comes up even though I know duplicates of the
    date exist in the range??

    What am I doing wrong?

    I am looking to refuse the entered date if it already exists in the range!

    Thanks so much for any help and feedback ?

    rn

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Date not found in range?

    How do you call the Security sub from your event code ?
    Also use Change-event instead of SelectionChange because my guess is that now it's looking at the wrong cell .
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Contributor
    Join Date
    03-07-2013
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    274

    Re: Date not found in range?

    Hi Bakerman2,

    Thanks for replying!
    Hmmm Change event doesn't work because in reality, the contents of the cell are changed by a calander date picker!

    And I don't know why the change event doesn't fire when date picker calendar modifies the
    date ??? A date picker is available in every cell in the E column.

    So anyways here's the whole code:


    Please Login or Register  to view this content.
    Last edited by RustyNail; 02-14-2019 at 12:24 AM.

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Date not found in range?

    Try this.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 02-14-2019 at 04:13 AM.

  5. #5
    Forum Contributor
    Join Date
    03-07-2013
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    274

    Re: Date not found in range?

    Hi Bakerman2,

    Somehow this line:

    Please Login or Register  to view this content.
    Does not return the calendar value picked???

    Really confusing this date picker stuff

    thanks

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Date not found in range?

    Works fine for me.
    I've left out 3 dates to choose from in the example file.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    03-07-2013
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    274

    Re: Date not found in range?

    Ok, after so many changes I finnaly was abe to get it to work!

    Thanks bakerman2!

    rn

+ 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. [SOLVED] Search for value in row. if found, copy column formulas into found column range
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-23-2017, 10:42 AM
  2. Excel 2013 - if date is found between date range return value
    By theshybutterfly in forum Excel General
    Replies: 4
    Last Post: 12-11-2016, 01:14 AM
  3. Search for value in a range and overwrite if found and create new if not found
    By mm671750 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-04-2016, 01:19 PM
  4. Replies: 10
    Last Post: 11-04-2015, 05:19 AM
  5. Replies: 4
    Last Post: 07-24-2015, 11:47 AM
  6. [SOLVED] range of date to be found on the table
    By sknalodz in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-06-2014, 09:30 AM
  7. Replies: 4
    Last Post: 08-04-2014, 04:48 AM

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