I store dates in the format of dd-mm-yyyy. When searching a date, my VBA code always reports date not found. So, I put in two message boxes to check the date format (see the following code). Both boxes report date as, say, 10-7-2011. However, when I open the spreadsheet and select find, the date in the find windows is the format of mm/dd/yyyy, e.g. 7/10/2011. No wonder the date is not found.
What causes the inconsistency and how do I rectify the problem?
=======================================
MsgBox ("date is " & voucherDate)
............
............
Set cell = rng2.Find(voucherDate, lookat:=xlWhole)
If Not r Is Nothing Then
MsgBox (voucherDate & " found")
Else
MsgBox (voucherDate & " not found")
End If
What causes the inconsistency and how do I rectify the problem?
=======================================
MsgBox ("date is " & voucherDate)
............
............
Set cell = rng2.Find(voucherDate, lookat:=xlWhole)
If Not r Is Nothing Then
MsgBox (voucherDate & " found")
Else
MsgBox (voucherDate & " not found")
End If