PDA

View Full Version : Solved: Userform - Populate textbox with result from popup



phendrena
11-05-2008, 06:54 AM
Hi,

I've got two userforms.
The second userform is a calendar.

I want the date picked from the calendar to be placed into the field txtDate on userform1. How can i do this? I'm adapting the code from code I have that places the data into the current cell....

Private Sub frmCalendar_Click()
ActiveCell = frmCalendar.Value
ActiveCell.NumberFormat = "dd/mm/yyyy"
End Sub

Private Sub UserForm_Activate()
If IsDate(ActiveCell.Value) Then
frmCalendar.Value = DateValue(ActiveCell.Value)
Else
frmCalendar.Value = Date
End If
End Sub

How can i get it to be entered into the userform rather than the worksheet cell. I know i'm going to need to change the ActiveCell but to what.

Thanks,

Bob Phillips
11-05-2008, 07:10 AM
Private Sub frmCalendar_Click()
frmMaster.TextBox1 = Format(frmCalendar.Value, "dd/mm/yyyy")
End Sub

phendrena
11-05-2008, 07:16 AM
Many thanks.

phendrena
11-05-2008, 07:19 AM
One further quick question....
The calendar popsup when they double click, how would i get it to popup when they enter the cell (via tabbing)...?

Cheers