Hi,
I've got a column of cells with date/time values and I need to compare to an specific date and time in VBA. I'm using a CASE where cell.value appears to be stored as decimal. How do I format specific the date and time that I created to see if the cell date/time is before or after?
Cell D2 = 2023-01-10 6:21:27 AM ...this is first cell in the column
shiftdate = 2021-01-10 ...and is a date variable
Here the statement:
Select Case Workbooks("text.xlsm").Worksheets("Sheet").Range("D2").Value 'debugger shows this as 44936.2648958333
Case Is < shiftdate & " " & "4:58:00 AM" ' it doesn't matter how early or later I make this time, it always goes into the case.
...
Thanks,
Mark
I've got a column of cells with date/time values and I need to compare to an specific date and time in VBA. I'm using a CASE where cell.value appears to be stored as decimal. How do I format specific the date and time that I created to see if the cell date/time is before or after?
Cell D2 = 2023-01-10 6:21:27 AM ...this is first cell in the column
shiftdate = 2021-01-10 ...and is a date variable
Here the statement:
Select Case Workbooks("text.xlsm").Worksheets("Sheet").Range("D2").Value 'debugger shows this as 44936.2648958333
Case Is < shiftdate & " " & "4:58:00 AM" ' it doesn't matter how early or later I make this time, it always goes into the case.
...
Thanks,
Mark