ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TimeSerial (https://www.excelbanter.com/excel-programming/290611-timeserial.html)

Rockee052[_30_]

TimeSerial
 
HI,

What would be the correct way to use a time serial between two time. I
need to set it up where the time are equivalent to everything after 8am
- Noon..


I have tried this
Case Is < TimeSerial(13, 0, 0) & TimeSerial(7, 0, 0)

I don't think this is right?

Thanks

Rockee Freeman


---
Message posted from http://www.ExcelForum.com/


JE McGimpsey

TimeSerial
 
One way:

Case TimeSerial(8, 0, 0) To TimeSerial(12, 0, 0)

would include both 8:00 and 12:00

Case TimeSerial(8, 0, 1) To TimeSerial(11, 59, 59)

would exclude both 8:00 and 12:00



In article ,
Rockee052 wrote:

HI,

What would be the correct way to use a time serial between two time. I
need to set it up where the time are equivalent to everything after 8am
- Noon..


I have tried this
Case Is < TimeSerial(13, 0, 0) & TimeSerial(7, 0, 0)

I don't think this is right?

Thanks

Rockee Freeman


---
Message posted from http://www.ExcelForum.com/


Rockee052[_31_]

TimeSerial
 
JE,

Thanks, I'll give it a try


Rockee Freeman


---
Message posted from http://www.ExcelForum.com/


Rockee052[_32_]

TimeSerial
 
JE,

Thanks, I'll give it a try


Rockee Freeman


---
Message posted from http://www.ExcelForum.com/


Rockee052[_33_]

TimeSerial
 
JE or Anyone,

This is my code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Select Case Time
Case Is < TimeSerial(13, 0, 0) & TimeSerial(8, 0, 0)
Beep
msg = "You do not need to print at this time!"
Ans = MsgBox(msg, vbInformation, "Cannot Print...")
Cancel = True
End Select
Exit Sub
msg = "Is the Shift Labor Report completed and accurate?"
Ans = MsgBox(msg, vbYesNo, "About to print...")
If Ans = vbNo Then Cancel = True
End Sub

I tried putting in:

Case TimeSerial(8, 0, 1) To TimeSerial(11, 59, 59)

I received an error, what do I need to change to get my code workin
correctly...

What I'm trying do is stop some employees from printing a report out
anytime after 8am-Noon...:confused:

Thanks
Rockee Freema

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

TimeSerial
 
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Select Case Time
Case TimeSerial(8, 0, 0) To TimeSerial(12, 0, 0)
Beep
msg = "You do not need to print at this time!"
Ans = MsgBox(msg, vbInformation, "Cannot Print...")
Cancel = True
Exit Sub
Case Else
msg = "Is the Shift Labor Report completed and accurate?"
Ans = MsgBox(msg, vbYesNo, "About to print...")
If Ans = vbNo Then Cancel = True
End Select
End Sub


Worked for me.


--
Regards,
Tom Ogilvy



Rockee052 wrote in message
...
JE or Anyone,

This is my code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Select Case Time
Case Is < TimeSerial(13, 0, 0) & TimeSerial(8, 0, 0)
Beep
msg = "You do not need to print at this time!"
Ans = MsgBox(msg, vbInformation, "Cannot Print...")
Cancel = True
End Select
Exit Sub
msg = "Is the Shift Labor Report completed and accurate?"
Ans = MsgBox(msg, vbYesNo, "About to print...")
If Ans = vbNo Then Cancel = True
End Sub

I tried putting in:

Case TimeSerial(8, 0, 1) To TimeSerial(11, 59, 59)

I received an error, what do I need to change to get my code working
correctly...

What I'm trying do is stop some employees from printing a report out
anytime after 8am-Noon...:confused:

Thanks
Rockee Freeman


---
Message posted from http://www.ExcelForum.com/




Rockee052[_34_]

TimeSerial
 
Tom,

When I adjusted the code I put:
Case Is
Instead of Case (whoops)

Thanks,
Rockee Freema

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com