Hello,
In a code, I compare the dates of a master File with those of a target file to determine where the last entry has been made. The code reliably conducts the comparison of Cell B37 of the target file with cell A12 of the master cell. For some reason, however, the code does not recognize when the dates are the same.
The relevant part of the VBA:
In the target file, "Date_new" gives me the last entry (January 6, 2023), which in this case is in cell B37:
DATE_new = ActiveCell.Value
Switching over to the master file...
Windows("Current_Market_Data_Europe_extract_comparing dates_Master.xlsm").Activate
That date is to be found in a table:
If Cells(i, 1).Value = DATE_new And Cells(i + 1, 1).Value <> "" Then
N.B. A "For...Next" loop relaibly leads to a value where cells(12,1).Value is addressed, i.e. the cell in the master file containing the entry "Jan. 6, 2023".
Problem: The comparison doesn't work, despite the dates being the same (January 6, 2023), including the formatting. Even when I make a direct comparion in Excel (see Master file cell G25), the statement that they are equal gives me a "false". Why are the two dates with the same formatting regarded as not being the same?
Excel_Arate
Bookmarks