R
RyanH
I have two command buttons in a userform; cmbCalculate & cmbAddToQuote.
cmbCalculate when clicked calculates a price. cmbAddToQuote adds the price
to the worksheet. In order to calculate a price the user must enter all
valid information into the userform, if not a message box prompts them what
to do and the sub exits.
My problem is what if the user clicks the cmbAddToQuote button before a
price is generated. I want to calculate the price and exit the entire sub if
not all information is entered. But this code does not work why?
Public Sub cmbCalculate_Click()
Dim ExitEntireSub as Boolean
If textbox1 = "" Then
MsgBox "You must enter Information in TextBox1."
ExitEntireSub = True
Exit Sub
End If
End Sub
Private Sub cmbAddToQuote_Click()
Call cmbCalculate_Click
If ExitEntireSub = True Then Exit Sub
'code to add information onto worksheet
End Sub
cmbCalculate when clicked calculates a price. cmbAddToQuote adds the price
to the worksheet. In order to calculate a price the user must enter all
valid information into the userform, if not a message box prompts them what
to do and the sub exits.
My problem is what if the user clicks the cmbAddToQuote button before a
price is generated. I want to calculate the price and exit the entire sub if
not all information is entered. But this code does not work why?
Public Sub cmbCalculate_Click()
Dim ExitEntireSub as Boolean
If textbox1 = "" Then
MsgBox "You must enter Information in TextBox1."
ExitEntireSub = True
Exit Sub
End If
End Sub
Private Sub cmbAddToQuote_Click()
Call cmbCalculate_Click
If ExitEntireSub = True Then Exit Sub
'code to add information onto worksheet
End Sub