I am experiencing a strange problem with a date picker macro that i use on many workbooks since upgrading to 2003
I get a Compile error: Variable not defined
However I can create a new workbook with the same code and it works fine
Here is the code
Option Explicit
' ===================================================
' Code by Martin Green eMail martin@fontstuff.com
' Visit my Office Tips web site at www.fontstuff.com
' ===================================================
Private Sub cmdClose_Click()
' Close the UserForm
Unload Me
End Sub
Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub
Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
ActiveCell.Value = Calendar1.Value
Unload Me
End Sub
I get a Compile error: Variable not defined
However I can create a new workbook with the same code and it works fine
Here is the code
Option Explicit
' ===================================================
' Code by Martin Green eMail martin@fontstuff.com
' Visit my Office Tips web site at www.fontstuff.com
' ===================================================
Private Sub cmdClose_Click()
' Close the UserForm
Unload Me
End Sub
Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub
Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
ActiveCell.Value = Calendar1.Value
Unload Me
End Sub