Select Case To Check Date Ranges

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

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
 

Forum statistics

Threads
1,082,167
Messages
5,363,528
Members
400,747
Latest member
monty_gl

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top