Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing a value to a variable from Userform
Dear Most Valued Experts,
I have a Userform where I am asking for information. In the code, when the user clicks OK, if the amount typed in is incorrect, I have a msgbox asking if the user wants to continue. If the answer is no, I need to exit the userform and go into another macro. If the answer is yes, to continue with the userform. What is the best way to set this up? Thanks. Neal |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing a value to a variable from Userform
Tom,
Thanks for your answer. It works like a charm! -----Original Message----- In a general module at the top Public bQuit as Boolean Sub Showform() bQuit = False Userform1.Show if bQuit then exit sub ' code to continue End Sub Private Sub cmdOK_Click() if Textbox1.Text = "" then res = msgbox("Do you want to continue, vbYesNo") if res = vbNo then bQuit = True unload me end if Msgbox "Please fix the value in the box" Textbox1.Setfocus Else me.hide ' or unload me end if End Sub I am sure there are many other ways to attack this problem and more knowledge of the situation may drive different solutions as well. Regards, Tom Ogilvy "Neal Steiner" wrote in message ... Dear Most Valued Experts, I have a Userform where I am asking for information. In the code, when the user clicks OK, if the amount typed in is incorrect, I have a msgbox asking if the user wants to continue. If the answer is no, I need to exit the userform and go into another macro. If the answer is yes, to continue with the userform. What is the best way to set this up? Thanks. Neal . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing variable values to userform control | Excel Discussion (Misc queries) | |||
Import into Access from Excel, passing a variable for the field... | Excel Worksheet Functions | |||
Passing string as array variable (Pivot VBA) | Excel Discussion (Misc queries) | |||
Passing Variable Number of Arguments to a Sub | Excel Discussion (Misc queries) | |||
Passing Variable to LINEST | Excel Worksheet Functions |