bloodmilksky
Board Regular
- Joined
- Feb 3, 2016
- Messages
- 202
Hi Guys,
I am using the below code to do checks for a automated holiday spreadsheet. if first checks to see if the user has enough holiday "<26" and then checks to see if they are not trying to request more that 10 days " < 10 ". the dates are declared in two cells From " B21" To "C21"
what I wanted to know if anyone knows a way that I could declare dates that are not allowed to be requested?
So if 20/12/2017-25/12/2017 was requested it would run a error message.
any help would be greatly appreciated
Jamie
I am using the below code to do checks for a automated holiday spreadsheet. if first checks to see if the user has enough holiday "<26" and then checks to see if they are not trying to request more that 10 days " < 10 ". the dates are declared in two cells From " B21" To "C21"
what I wanted to know if anyone knows a way that I could declare dates that are not allowed to be requested?
So if 20/12/2017-25/12/2017 was requested it would run a error message.
any help would be greatly appreciated
Jamie
Code:
Sub TooManyHolidays()Dim msg As String
Dim Ans As VbMsgBoxResult
If Sheets("Request Form").Range("B14") < 26 And Sheets("Request Form").Range("E21") < 10 Then
NewBookingCheck.NewBookingCheck
ElseIf Sheets("Request Form").Range("B14") >= 26 Then
msg = (" You Dont Have Enough Holiday! Would You Like To Continue? ")
Ans = MsgBox(msg, vbYesNo)
If Ans = vbNo Then
Sheets("Request Form").Select
Range("Employee3").ClearContents
Range("DateRequest").ClearContents
Application.DisplayAlerts = False
ThisWorkbook.Save
Application.DisplayAlerts = True
WorkbookClose