Transfering Data From Userform1 to TextBox1 in UserForm2

  • Thread starter Thread starter ironhydroxide
  • Start date Start date
I

ironhydroxide

I Have two Userforms, and i use input from the first userform to find the
information i want to be placed in the second userform (the data is in Cells
on the Active Sheet, and will be Names, or Dates). I have tried a couple
ways, and the helpsearch function doesnt really give information on this.

I figure one uses

`Get My information

Userform1.Hide

Load Userform2

With UserForm2
TextBox1=MyData
End With

UserForm2.Show

`Here is where i want my data to show in the TextBox1 of UserForm2

But when i try this, the data doesnt show on the userForm, What am i doing
wrong?

Thanks for all replies

ironhydroxide
 
Try prefacing the TextBox'es with the UserForm's name. Using default
UserForm names...

UserForm1.TextBox1.Value = UserForm2.TextBox1.Value

or vice versa depending on which value you are assigning to which TextBox.
You don't actually need the UserForm name for the active UserForm as use it
would be the default, but it can't hurt to specify it to make things
clearer.
 
Normally, I enter the data into the Sheet first.

Private Sub CommandButton1_Click()
On Error Resume Next
Sheets("Sheet1").Visible = True
Sheets("Sheet1").Activate

Cells(1, 2) = TextBox1.Text
Cells(2, 2) = TextBox2.Text

Unload UserForm1

On Error Resume Next

UserForm2.Show
End Sub

Private Sub CommandButton2_Click()
On Error Resume Next
Sheets("Sheet1").Activate

TextBox1.Text = Format(Cells(1, 2), "#,##0.00")
TextBox2.Text = Format(Cells(2, 2), "#,##0.00")

On Error Resume Next
End Sub

Clear the used ranges, before performing additional calculations, if
necessary.

HTH,
Ryan---
 
Back
Top