date range vba code
New to vba. Trying to do a basic date range. If calendar
date is between start date and end date then display date
matches if not then display date doesn't match.
I know its something really simple. Please help.
Sub Macro2()
Dim calendar_dte, start_dte, end_dte As Integer
calendar_dte = Range("E1").Select 'calendar date
start_dte = Range("D1").Select 'Start Date
end_dte = Range("D2").Select 'End Date
If (calendar_dte = start_dte And calendar_dte <= end_dte)
Then
MsgBox "Calendar Date Matches Vacation Range"
Else
MsgBox "Calendar Date Does Not Match Vacation Range"
End If
End Sub
|