I created a form called frmCalendar that shows a calendar with the
following codes:
Private Sub Calendar1_Click()
'transfers the date selected on the calendar to the active cell.
ActiveCell = Calendar1.Value
ActiveCell.NumberFormat = "mm/dd/yy"
' closes the form.
Unload Me
End Sub
Private Sub UserForm_Activate()
Me.Calendar1.Value = Date
End Sub
Private Sub UserForm_Initialize()
' to see if the active cell already contains a date.
'If it does, then the calendar will show the same date when it opens.
'If there is no date in the cell (or if what is in the cell isn't a
date) the calendar will show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub
I have a new form called frmCowEnrollment with a textbox that the
user will use to enter a date.I would like to have the date enter
from the calendar.
When the user select a command button call cmdCallCalendar close to
the textBox, the frmCalendar will pop-up.Then the user will click a
date on the calendar that will become the value of the text box.
Private Sub cmdCallCalendar_Click()
frmCalendar.Show
If txtEnrollDate.Value = "" Then
txtEnrollDate.Value = Calendar1.Value
End If
End Sub
This section is not working, please could you help me.