referring to a textbox on a different userform.

A

aintlifegrand79

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
 
N

Norman Jones

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
'<<=============
 
K

Ken

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top