ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   referring to a textbox on a different userform. (https://www.excelbanter.com/excel-programming/411395-referring-textbox-different-userform.html)

aintlifegrand79

referring to a textbox on a different userform.
 
I am using two userforms ("ufZipCodeMarket" and "ufRepInfo") and want to
populate the textbox ("tbZipCode2") on userform("ufRepInfo") by entering a
value into the textbox ("tbZipCode") on userform ("ufZipCodeMarket") and
pressing a command button ("cbFind") on that userform. Thank you for you help

Norman Jones[_2_]

referring to a textbox on a different userform.
 
Hi Aintlifegrand79,

In the module of the ufZipCodeMarket
Userform, try pasting the following code:

'=============
Private Sub CommandButton2_Click()
Dim sStr As String

sStr = Me.TextBox1.Value

With ufRepInfo
.Show
.TextBox1.Value = sStr
End With

End Sub
'<<=============



---
Regards.
Norman


"aintlifegrand79" wrote in
message ...
I am using two userforms ("ufZipCodeMarket" and "ufRepInfo") and want to
populate the textbox ("tbZipCode2") on userform("ufRepInfo") by entering a
value into the textbox ("tbZipCode") on userform ("ufZipCodeMarket") and
pressing a command button ("cbFind") on that userform. Thank you for you
help



Ken

referring to a textbox on a different userform.
 
Maybe this will help:

If you have two userforms, userform1 and userform2, they both have a
textbox1 and one has a commandbutton1. If you have them both shown,
maybe using code like:

Sub test()
UserForm1.Show modal
UserForm2.Show modal
End Sub

If the code associated with the command button on the first userform
is:

Private Sub CommandButton1_Click()
UserForm2.TextBox1.Text = UserForm1.TextBox1.Text
End Sub

and you put some text in textbox 1 on userform1 and click the button,
that text will show up in the textbox on userform2.

Good luck.

Ken
Norfolk, Va

On May 22, 2:13*pm, aintlifegrand79
wrote:
I am using two userforms ("ufZipCodeMarket" and "ufRepInfo") and want to
populate the textbox ("tbZipCode2") on userform("ufRepInfo") by entering a
value into the textbox ("tbZipCode") on userform ("ufZipCodeMarket") and
pressing a command button ("cbFind") on that userform. *Thank you for you help




All times are GMT +1. The time now is 12:29 PM.

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