passing data from one userform to another


I have 2 userforms in an excel macro, in the first one there is a text field and button near it. when the button is pressed, a second userform opens. On the second userform, there is the calander control with an ok button. when a date is selected, and the ok butotn is pressed, I want the second userform to be dismissed, and the date entered into the text field on the first userform with the format dd/mm/yyyy - not including the hours and mins. or whatever goes by default. I also need to reference that date inside the macro in another function within the first userform.
can someone explain how variables are passed along in vba?

thanks in advance
Who is Participating?
EDDYKTConnect With a Mentor Commented:
>>where do i put this

Just insert the module into your excel

Just add module and create a public variable there

set the variable when your second form unload


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

d = "your date form string"
End Sub
cedopAuthor Commented:
where do i put this
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.