-
Transferring data from one Userform to the next
I'm trying to write code that solves an equation based on user input.
But I cannot figure out how to make a Label in a new userform dependent on the variable 'answer' as defined in the userform right before the last one. I just need the final calculation presented in a new userform and not a msgbox.
thanks for any help you can give me. the variables are all defined in the module.
-
picture of actual project:
hphotos-snc3.fbcdn.net/hs070.snc3/13769_1181546185891_1445280033_30511844_1957890_n.jpg
-
One way:
Add 2 Userforms, put a Textbox on 1, and a Label on 2
On the Userform1 code module, put
[VBA]
Option Explicit
Private Sub cbDone_Click()
Call UserForm2.Hide
Unload UserForm2
Call UserForm1.Hide
Unload UserForm1
End Sub
Private Sub tbInput_Change()
UserForm2.labOutput.Caption = UserForm1.tbInput.Text
End Sub
Private Sub tbInput_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Call tbInput_Change
End Sub
[/VBA]
I added a worksheet button, but the .Show code can go anywhere (almost)
[VBA]
Private Sub CommandButton1_Click()
Load UserForm2
Call UserForm2.Show(vbModeless)
Load UserForm1
Call UserForm1.Show(vbModeless)
End Sub
[/VBA]
Paul
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules