![]() |
comparing excel dates in vb macro
I am just into vb macro. so Could anybody please help me out! I want to
know comparison of two dates of excel in macro, since there is mismatch of formats (EXCEL :DD-MM-YY & VB:mm/dd/yy) Could you help me coding - how to compare two dates in Macro. Suppose A1 contains 28-11-00. I want to check whether the value in A1 is LESS THAN 02-3-01 and greater than or equal to 16-12-98 . Thanking you in anticipation With regards -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200908/1 |
comparing excel dates in vb macro
Try this:
Print Range("A1") < DateSerial(2001, 3, 2) And Range("A1") = DateSerial(1998, 12, 16) Regards, Stefi €˛lataa3 via OfficeKB.com€¯ ezt Ć*rta: I am just into vb macro. so Could anybody please help me out! I want to know comparison of two dates of excel in macro, since there is mismatch of formats (EXCEL :DD-MM-YY & VB:mm/dd/yy) Could you help me coding - how to compare two dates in Macro. Suppose A1 contains 28-11-00. I want to check whether the value in A1 is LESS THAN 02-3-01 and greater than or equal to 16-12-98 . Thanking you in anticipation With regards -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200908/1 |
comparing excel dates in vb macro
To compare apples with apples, You may want to try something like this:
result = CDate(Range("A1")) CDate("28-11-00") With regards Mishell "lataa3 via OfficeKB.com" <u54234@uwe wrote in message news:9b5051159aa75@uwe... I am just into vb macro. so Could anybody please help me out! I want to know comparison of two dates of excel in macro, since there is mismatch of formats (EXCEL :DD-MM-YY & VB:mm/dd/yy) Could you help me coding - how to compare two dates in Macro. Suppose A1 contains 28-11-00. I want to check whether the value in A1 is LESS THAN 02-3-01 and greater than or equal to 16-12-98 . Thanking you in anticipation With regards -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200908/1 |
comparing excel dates in vb macro
On Aug 29, 11:27*am, "lataa3 via OfficeKB.com" <u54234@uwe wrote:
I am just into *vb macro. so Could anybody please help me out! * I want to know comparison of two dates of excel in macro, *since there is mismatch of formats (EXCEL :DD-MM-YY & VB:mm/dd/yy) Could you help me coding *- how to compare two dates in Macro. Suppose A1 *contains *28-11-00. * I want to check *whether the value in A1 is LESS THAN * 02-3-01 and greater than or equal to 16-12-98 *. Thanking you in anticipation With regards -- Message posted via OfficeKB.comhttp://www.officekb.com/Uwe/Forums.aspx/excel-programming/200908/1 You can use GemBox.Spreadsheet: http://www.gemboxsoftware.com/GBSpreadsheet..htm It can read different date formats, convert it to one and then easily compare |
All times are GMT +1. The time now is 12:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com