MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

data transfer

  Asked By: Lu    Date: Aug 17    Category: MS Office    Views: 1504

how to transfer data from one form "cobmo box" to another form
please help me



2 Answers Found

Answer #1    Answered By: Fuzairah Neeman     Answered On: Aug 17

Here are three methods.

1. This may not be feasible in your case, but you could combine the two forms
into one, as separate pages on a MultiPage control. Then you can refer directly
to the combobox from the other control, because they are members of the same

2. The easiest other way is to use a global variable. In a VBA module in your
workbook, declare a global variable. For example:

Global SelText As String

In the code for the form  with the combobox, use the Change event to set the
value of SelText whenever a selection is made from the combobox. For example:

Private Sub ComboBox1_Change()
SelText$ = Me.ComboBox1.Value
End Sub

In the code for the other form, use the Activate event to update the control
on the form (for example, a textbox) with the current value of SelText. For

Private Sub UserForm_Activate()
Me.TextBox1.Text = SelText$
End Sub

3. Instead of defining a global variable (some programmers object to them),
you could write the combobox value to a worksheet cell (perhaps on a hidden
sheet), then read the value in that cell from the second form.

Answer #2    Answered By: Brandi Ramirez     Answered On: Aug 17

you can use following code:

UserForm2.ComboBox1.AddItem (UserForm1.ComboBox1.Value)

This is will work if your both forms are in same project.

Didn't find what you were looking for? Find more on data transfer Or get search suggestion and latest updates.