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?
Assuming that your forms are named:
Userform1
for this first form Userform2
for the second form And assuming that you have two textboxes one in each form as follow:
TextBox1
for the first textbox located in your first form TextBox2
for the second textbox located in the second form You assign the value of the first TextBox1
to TextBox2
using Userform2.TextBox2.Text=Userform1.TextBox1.Text
You can declare a public variable:
ie X
. In user form 1 x=textbox1.value
and in user form2 textbox2.value=X
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.