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
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
CurrentTime = Format(now()),"h:mm")

If CurrentTime < "15:45" then
Msgbox "not yet"
End If
 
Upvote 0
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!
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top