Using multiple user forms to perform Calculations

E

eklarsen

Very new to VBA but I will try to explain and be as brief as possible.
Using Excel 10 (2002) I am trying to use two user forms one to have th
user enter parameter needed and the other to return the calculate
results.
The first form is as follows;
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub CommandButton1_Click()
Call fmberesults.Show
End Sub
Private Sub SpinButton1_Change()
tbsplit.Text = SpinButton1.Value
End Sub
Private Sub SpinButton2_Change()
tbwab_rt.Text = SpinButton2.Value
End Sub
Private Sub SpinButton3_Change()
tbWaa_Rt.Text = SpinButton3.Value
End Sub
Private Sub SpinButton4_Change()
tbPov_Meas.Text = SpinButton4.Value
End Sub
Private Sub tbPov_meas_change()
NewVal = Val(tbPov_Meas.Text)
If NewVal >= SpinButton4.Min And NewVal <= SpinButton4.Max The
SpinButton4.Value = NewVal
End Sub
Private Sub tbwaa_rt_change()
NewVal = Val(tbWaa_Rt.Text)
If NewVal >= SpinButton3.Min And NewVal <= SpinButton3.Max The
SpinButton3.Value = NewVal
End Sub
Private Sub tbwab_rt_change()
NewVal = Val(tbwab_rt.Text)
If NewVal >= SpinButton2.Min And NewVal <= SpinButton2.Max The
SpinButton2.Value = NewVal
End Sub
Private Sub tbsplit_change()
NewVal = Val(tbsplit.Text)
If NewVal >= SpinButton1.Min And NewVal <= SpinButton1.Max The
SpinButton1.Value = NewVal
End Sub

I was able to test within this userform and got it to returnthe correc
answer to this;


'Sub tbdiscount_Change()
'Call Results
'End Sub

'Sub tbPtr_fl_Change()
'Call Results
'End Sub

'Sub Results()
' On Error Resume Next
' Dim Ptr_flinput As Currency
' Ptr_flinput = tbPtr_fl.Value
'Dim discountinput As Currency
' discountinput = tbdiscount.Value
'Dim Testinput As Currency
' Testinput = tbTest.Value(Round(2))

' tbTest.Value = "$" & (Ptr_flinput - discountinput)

'End Sub

The problem is after the user enters the data I have a "calculate
button that launches the second form;

"Private Sub CommandButton1_Click()
Call fmberesults.Show
End Sub"

But I do not know how to link the listbox that should contain th
answer to the first user form and perform the calculation that was don
sucessfully within the original user form. I believe I need to have th
Sub out in a module instead of in a private sub but any direction woul
be appreciated.

This is the code for the second form;
Sub Results()
On Error Resume Next
Dim Ptr_flinput As Currency
Ptr_flinput = tbPtr_fl.Value
Dim discountinput As Currency
discountinput = tbdiscount.Value
Dim disptrinput As Currency
disptrinput = tbdisptr.Value(Round(2))

tbdisptr.Value = "$" & (Ptr_flinput - discountinput)

End Sub



Private Sub CancelButton_Click()
Unload Me
Unload fmbetool
End Sub

Sorry for the long post but I wanted to be clear, not sure if it wa
but I tried
 

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