Execute VB code depending on time of day

W

WA

Hi,

I have the clock (24 format) in a spreadsheet. When a user clicks a button,
I would like to see the procedure executed only if it is after a certain
time. ie. if it is after 17:00, then the function will run, otherwise a msg
will state that it is too early.

I've looked at the OnTime code, but it will not serve my purpose.
Any ideas would be greatly appreciated.

Thanks,

WA
 
J

Jim Thomlinson

My preference for that kind of thing would be to use the ontime method. When
the spreadsheet is opened check the time and if it is after 17:00 then enable
the button otherwise disable. Have the on time method enable the button at
17:00. That code is very lightweight. The nice thing about it is that the
user can only click the button when it is valid to do so. No need for a
message box telling the user that they can not do something that you never
intended to let them complete.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top