Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 1,124
- Office Version
- 365
- Platform
- Windows
Hi All,
I'm working on a macro whereby I'd like it to function between two dates, respectfully.
And pop an Msgbox, if it falls outside of these two dates.
I've picked these dates as a test.
I have this posted at the top before my code:
It worked once, than it didn't after that, if you can believe it.
Can you please help me sort this out properly?
Many thanks in advance!
Pinaceous
I'm working on a macro whereby I'd like it to function between two dates, respectfully.
And pop an Msgbox, if it falls outside of these two dates.
Code:
startDate = "15/01/2015"
endDate = "25/03/2015"
I've picked these dates as a test.
I have this posted at the top before my code:
Code:
Function BetweenDates(startDate As String, endDate As String) As Boolean
BetweenDates = IIf(CDate(startDate) <= CDate(endDate), True, False)
End Function
Code:
Dim startDate As String, endDate As String
startDate = "15/01/2015"
endDate = "25/03/2015"
On Error GoTo ErrHandler1
'Code stuff
ErrHandler1:
MsgBox "This was already Executed!!"
Application.Cursor = xlDefault 'on completion / error
Exit Sub
End Sub
It worked once, than it didn't after that, if you can believe it.
Can you please help me sort this out properly?
Many thanks in advance!
Pinaceous