View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Passing a value from one userform to another (multiple) form


Userform1


Public TB As MSForms.TextBox

Private Sub TextBox1_Enter()
Set TB = Me.TextBox1
UserForm2.Show
End Sub

Private Sub TextBox2_Change()
Set TB = Me.TextBox2
UserForm2.Show
End Sub

Userform2

Private Sub ComboBox1_Change()
UserForm1.TB.Text = Me.ComboBox1.Value
Me.Hide
End Sub



--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Ketut" wrote in message
...
I have two userforms, form A and form B. Form A contains 10 textboxes
(txtbox1, txtbox2, ..., txtbox10), and form B contains a combobox and an
OK
button.

What I want to achieve is as follow: whenever the user click one of the
ten
textboxes if form A, form B will show. The user then select one value from
the combobox, click OK, and the selected value will be sent to the textbox
that was clicked initially. How do I make form B to recognize which
textbox
that was clicked by the user?

P.S. Obviously, it will be easier if I can replace the ten textboxes in
form
A with comboboxes, and eliminate the need to have form B altogether, but
unfortunately I do not have enough space in form A to do that. Each entry
in
the combobox consist of 4 numbers followed by a description, and the
textboxes in form A have just enough width to show only the numbers.