PDA

View Full Version : Forward Selected dates to another UserForm



javeed
06-15-2017, 08:38 PM
Hi,

On UserForm1 calendar picker where dates are selected and want to pass the selected date to another UserForm (Master) TextBox6 and TextBox7.

In UserForm1


Private Sub cmdOK_Click()
'dFDay and dLDay are the two dates selected.

If dFDay > 0 And dLDay > 0 Then
Master.TextBox6 = dFDay
Master.TextBox7 = dLDay
End If
End Sub


How to send this dFDay to Master.TextBox6 & dLDay to Master.TextBox7 on pressing OK button exit the Userform1 and activate Master with selected dates in TextBox6 & 7.

Thanks.

SamT
06-16-2017, 10:18 AM
Try this
Option Explicit

Private Sub cmdOK_Click()
'dFDay and dLDay are the two dates selected.

If dFDay > 0 And dLDay > 0 Then
Load Master 'Master is the actual name of the other UserForm
'Load(UserForms("Master")) 'May be this syntax.
Master.Controls("TextBox6") = dFDay
'UserForms("Master").Controls("TextBox6") = dFDay
Master.Controls("TextBox7") = dLDay
Master.Show
Unload Me 'Me is ThisUserForm
'Unload(Me)
End If
End Sub