User forms

E

eklarsen

I posted a bit of code in a previous post and got no replies so
thought I would ask a simpler question.
Is it possible to have a user enter data on one user form and usin
that data return the answer (calculated) to another user form that i
called when the user presses an action button?
Will this code need to be in a Module or is it ok to leave it in th
private Sub in the Userform.

Is it possible to call data from userform1 to userform2 if the code i
not in a module?

Sorry if this seem's simple but I am very new to VBA.
Thanks for taking the time
 
B

Bob Phillips

Here is a very simple example of what you ask.

I have 2 userforms with a textbox on each. On the first I also have a
button, and this code, on a button press, will copy the contents of the
textbox on form1 to the textbox on form2, and then show form2. All in the
userform code module

Private Sub CommandButton1_Click()
UserForm2.TextBox1.Text = Me.TextBox1.Text
UserForm2.Show
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top