I need to store a date as a global variable. I thought I was doing this but the watch shows it resetting after the sub ends. I've looked at countless global variable articles and responses to questions, nothing seemed to work.
So, just how do I stop this from happening in my VBA code as I need to call the variable in later subs?
Option Explicit
Public strDate As Variant
Sub SelectDate()
strDate = InputBox("Select Report Date (mm/dd/yy)", "Report Date", Format(Now() - 1, "mm/dd/yy"))
If IsDate(strDate) Then
strDate = Format(CDate(strDate), "mm/dd/yy")
Else
MsgBox "Valid Date Format Required"
End If
End Sub