I have 2 textboxes DataBox1 and DataBox2, I have them both configured that when they are clicked a calendar pops up for the user to select the date. However, I can't figure out how to make it the Calendar fill the slected TextBox, right now I have it working for DataBox1 but can't figure out how to make it work for 1 & 2.
Code:
Option Explicit
'Thanks to fontstuff for the example code
' ===================================================
' Code by Martin Green eMail [EMAIL="martin@fontstuff.com"]martin@fontstuff.com[/EMAIL]
' Visit my Office Tips web site at [URL="http://www.fontstuff.com"]www.fontstuff.com[/URL]
' ===================================================
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(DataReport.DateBox1.Value) Then
Calendar1.Value = DateValue(DataReport.DateBox1.Value)
Else
Calendar1.Value = Date
End If
End Sub
Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
DataReport.DateBox1.Value = Calendar1.Value
Unload Me
End Sub