OK, I probably made some really simple mistake here, but I'm not finding it (no pun intended). Trying to use the Range.Find method to find records of contributions within a certain date range. Here is the code:
For SearchDate = StartDate To EndDate
Set FoundDate = [ContributionsDates].Find(What:=SearchDate, LookIn:=xlValues, LookAt:=xlWhole)
If FoundDate Is Nothing Then GoTo DateNotFound
FirstRowC = FoundDate.Row
Do
.... other code here
DateNotFound:
Next SearchDate
StartDate, EndDate, and SearchDate are all declared as Date type. StartDate is set to 12/28/15. EndDate is set to 1/3/16. [ContributionsDates] is a range (of 14 contiguous cells within a single column), all formatted as dates, and with the first 6 cells containing dates (that are either 12/31/15 or 1/1/16). Remaining cells in the range are blank.
When I manually step through the macro, each time through the loop (for every value of SearchDate, including 12/31/15 and 1/1/16) FoundDate is set to Nothing so it just steps to DateNotFound.
Why isn't it correctly finding these dates?!?
Running Excel 2007, by the way.
Bookmarks