Reputation: 17
I have two user forms in Excel VBA. I enter a value in the TextBox
at the first UserForm
. How do I pass the value to the second UserForm
to display same value in a TextBox
too?
Upvotes: 0
Views: 8719
Reputation: 36
You can declare a public variable:
i.e X
. In user form 1 x=textbox1.value
and in user form2 textbox2.value=X
.
Upvotes: 0
Reputation: 1934
Assuming that your forms are named:
Userform1
for this first formUserform2
for the second formAnd assuming that you have two textboxes one in each form as follow:
TextBox1
for the first textbox located in your first formTextBox2
for the second textbox located in the second formYou assign the value of the first TextBox1
to TextBox2
using Userform2.TextBox2.Text=Userform1.TextBox1.Text
Upvotes: 1