VBA: comparing dates

mkingrey

New Member
Joined
Nov 2, 2005
Messages
49
I am using VB a program that runs a loop to compare dates in two adjacent columns and peforms actions based on the boolean value returned. This code seems to work perfectly except whenever a date on the 9th day of a given month is compared with another date, its boolean value returned is incorrect. The code itself seems to be fine so I did not include it here, so it has to be related to the data or data type.

this is what my VBA tells me

Exp:

06/10/05 > 06/09/05 = False
07/11/05 > 07/09/05 = False
however if the months it runs correctly
07/01/05 > 06/09/05 = True


Anyone know why the 9th day of the month is always greater the all other days in the month?
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

mkingrey

New Member
Joined
Nov 2, 2005
Messages
49
is the example that should say, "however if the months are different then it runs correctly." - sorry
 

Watch MrExcel Video

Forum statistics

Threads
1,118,033
Messages
5,569,777
Members
412,291
Latest member
marypolitan
Top