LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass variable from one workbook to another calebjill Excel Discussion (Misc queries) 2 January 28th 09 07:38 PM
Pass Variable to another Sub CSUS_CE_Student[_2_] Excel Programming 5 February 27th 08 01:24 AM
pass a variable to a public sub Joanne Excel Programming 4 August 11th 07 10:33 PM
How to pass a variable into an SQL statement CLamar Excel Discussion (Misc queries) 0 June 5th 06 02:17 PM
Pass a variable into a range? Ian Fleming[_2_] Excel Programming 1 September 7th 05 09:45 AM


All times are GMT +1. The time now is 02:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"