Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass a Variable from one sub to another sub
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
pass variable from one workbook to another | Excel Discussion (Misc queries) | |||
Pass Variable to another Sub | Excel Programming | |||
pass a variable to a public sub | Excel Programming | |||
How to pass a variable into an SQL statement | Excel Discussion (Misc queries) | |||
Pass a variable into a range? | Excel Programming |