none
Find date in Range finds wrong date RRS feed

  • Question

  • I have a simple Range of dates (dd-mm-yyyy)

    I search this Range for a specific date, to find the row number of this date in the Range.

    It works fine, except when I search for a date in november or december.

    Example:

    Search for "01-01-2020" in this Range, from line 1: 

    01-11-2020 (finds this one first - Not good, I did NOT search for this)

    01-01-2020 (finds this one by using FindNext - OK)

    02-01-2020

    Somehow, Excel has decided to use a "wildcard" for the month-10's (the one marked with bold above).

    I have tried "everything" to avoid this, with no luck.

    How can I avoid this, and why does Excel/VBA act this way?

    This is my Find() code:

    Set myRange = ws1Rng.Find(findDate, After:=.Cells(lRowW1, 2))

    Thanks / Kaare

    Thursday, January 30, 2020 3:36 PM

All replies