Need some help with the asinine intricacies of vba

so the code is on pastebin: /UBe1zDdi (sorry, can’t create links).

Unfortunately, I can’t upload forms, however they are easily re-creatable. 2 combo in a vba userform. cmbFromTime and cmbToTime. upon initialization, they populate with time slots beginning w/ ‘7:00 AM’ and incrementing by 30 minutes until they reach a maximum number of slots determined by the constants. the cmbToTime should end at ‘2:00 AM’

So, the problem i’m having with is in the UpdateToCombo sub. This code executes well for any time in the cmbFromTime except ‘12:00 PM’ and ‘12:30 PM’ where the times don’t populate the ‘2:00 AM’ slot.

the UpdateToCombo subroutine is called by the cmbFromTime_Change event. It is the only line of code in that event.
Call UpdateToCombo(cmbFromTime.value)

So, as a test, I set both sides of the if statements to x and y respectively (of type variant). if I Debug.Print x & vbnewline & y, they print out to the same thing. When I look at x and y in the locals window, they are identical. if I CDbl them, they evaluate to the same number as far I can tel. But… if I Debug.Print x - y then they evaluate to weirdness.

There is a very real possibility that I’m an idiot here and it’s something super obvious; but, for the life of me, I can’t see it. Any help would be appreciated.

I took a quick look, I’m not set up to test for it - but I’m wondering about the if statement in the UpdateToCombo routine. My guess is because your not factoring in the date, in your mind you see the time progressing from one date to the next, but in the code when the processing gets beyond 11:30 pm it then hopes back to midnight of the same day (not the next day). Think about about it and see if that helps?

Considered that and tried Date as the vartype. The output doesn’t actually hop to the next date. The date is the same even when adding enough time to go past 12:00, 12/30/1899. Only the time changes. Also, if that were the case then when it got past 12:00 it would weird out, instead its getting past 1:30 before it weirds out.

Upon further testing, what I’ve discovered is that its evaluating to almost the same thing, but the differences are past the point where the locals window and debug.print truncate. Got here by just setting each side of the if statement to independent double variables. Which then brings me to the question, why is something that evaluates to literally the same time when you do the math in your head evaluate to something only slightly different when you do it with date values? Shouldn’t 2:00 AM be the same thing no matter how you do the math? I get that there’s seconds etc but those aren’t being modified here, its just the minutes.

So I find that explaining it to someone who doesn’t know what you’re talking about can lead to a lateral solution that feels very “no duh!?” when you think about it after the fact. She said “Well if they’re almost the same thing then just round it up so that they are.” Which is the solution I’ve gone with and that works fine. I still would like to know where I went wrong though.