ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User forms (https://www.excelbanter.com/excel-programming/297408-user-forms.html)

eklarsen[_4_]

User forms
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

User forms
 
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)

"eklarsen " wrote in message
...
I posted a bit of code in a previous post and got no replies so I
thought I would ask a simpler question.
Is it possible to have a user enter data on one user form and using
that data return the answer (calculated) to another user form that is
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 the
private Sub in the Userform.

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

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


---
Message posted from http://www.ExcelForum.com/




eklarsen[_5_]

User forms
 
Thanks Bob, it worked like a champ

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 08:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com