explanation of time in VB

poorwallace

Active Member
Joined
Mar 8, 2005
Messages
365
Boy...I sure seem to be asking more questions that I try to answer these days...So here is my question...

I have the following code, and it works....

Code:
Dim CurrentTime
CurrentTime = Now()

If CurrentTime < "3:45:00 PM" Then
    MsgBox "It's not time yet!"
End If

But I would like to know how I can reference CurrentTime against say "15:45:00" instead of "3:45:00 PM" (as I have figured out, the PM part of that is critical for the way I have approached this situation).

Thanks
Wally
 

Some videos you may like

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

XLGibbs

Well-known Member
Joined
Feb 25, 2005
Messages
2,446
CurrentTime = Format(now()),"h:mm")

If CurrentTime < "15:45" then
Msgbox "not yet"
End If
 

poorwallace

Active Member
Joined
Mar 8, 2005
Messages
365
Thanks...I understand your approach, so I'll play around with it to customize to what I'm looking for.

Thanks Again! I'm always learning!
 

Watch MrExcel Video

Forum statistics

Threads
1,118,032
Messages
5,569,767
Members
412,291
Latest member
marypolitan
Top