helpneeded2
Board Regular
- Joined
- Jun 25, 2021
- Messages
- 110
- Office Version
- 365
- Platform
- Windows
I only have a very surface level understanding of VBA.
I cannot figure out why this is generating an error:
When I try executing this, I get a Compile error message: Invalid outside procedure
Could someone please let me know what I am doing wrong.
I cannot figure out why this is generating an error:
VBA Code:
Dim DateStart As Date
Dim DateEnd As Date
DateStart = ThisWorkbook.Sheets("Sheet1").Range("D4").Value
DateEnd = ThisWorkbook.Sheets("Sheet1").Range("D6").Value
Sub RetrieveData()
If DateStart = True Or DateEnd = True Then
MsgBox "Date must be entered for both the Start Date and the End Date!"
Else
If DateStart > DateEnd Then
MsgBox "The End Date must be greater than the Start Date!"
Else
MsgBox "Good to Go"
End If
End If
End Sub
When I try executing this, I get a Compile error message: Invalid outside procedure
Could someone please let me know what I am doing wrong.