Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to close 2nd user form
I am just beginning to learn how to use forms. I was able to get one
form to open and close fine, then I added a 2nd form. I admit I am working by Rote, as I do not yet fully understand what I am coding. Here is the code I use to open the 1st user form (I left out some stuff that did not seem essential to the question). Sub form1() UserForm.Show If UserForm.OptionButton1.Value = True Then Range("A10").Value = 7 If UserForm.OptionButton2.Value = True Then Range("A10").Value = 6 If Range("A10").Value = 6 Then Call ConfirmDecision End Sub ------------------------------------------------------------------ Then in the forms coding, I put Private Sub CommandButton1_Click() UserForm.Hide End Sub Private Sub UserForm_Click() End Sub ================================================== ===== The 2nd form opens fine...but when I click on the button to try to close it, I get an error message UserForm1.Show If UserForm1.OptionButton1.Value = True Then Range("B8").Value = 8 If UserForm1.OptionButton2.Value = True Then Range("B8").Value = 9 Range("F13").Select Private Sub CommandButton1_Click() UserForm1.Hide End Sub Private Sub UserForm1_Click() End Sub I have spent hours of trial and error. Any help would really be appreciated. RJQman |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to close 2nd user form
hi,
from your code i see you are loading them as modal. when a form is modal, the user must respond before using any other part of the application. No subsequent code is executed until the form is hidden or unloaded. to set as modaless... Yourform.show 0 if you omit the zero, the form will load as modal. modal = 1. Modal is default. regards, FSt1 " wrote: I am just beginning to learn how to use forms. I was able to get one form to open and close fine, then I added a 2nd form. I admit I am working by Rote, as I do not yet fully understand what I am coding. Here is the code I use to open the 1st user form (I left out some stuff that did not seem essential to the question). Sub form1() UserForm.Show If UserForm.OptionButton1.Value = True Then Range("A10").Value = 7 If UserForm.OptionButton2.Value = True Then Range("A10").Value = 6 If Range("A10").Value = 6 Then Call ConfirmDecision End Sub ------------------------------------------------------------------ Then in the forms coding, I put Private Sub CommandButton1_Click() UserForm.Hide End Sub Private Sub UserForm_Click() End Sub ================================================== ===== The 2nd form opens fine...but when I click on the button to try to close it, I get an error message UserForm1.Show If UserForm1.OptionButton1.Value = True Then Range("B8").Value = 8 If UserForm1.OptionButton2.Value = True Then Range("B8").Value = 9 Range("F13").Select Private Sub CommandButton1_Click() UserForm1.Hide End Sub Private Sub UserForm1_Click() End Sub I have spent hours of trial and error. Any help would really be appreciated. RJQman |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Close User Form | Excel Discussion (Misc queries) | |||
Call user form from ThisWorkbook; close file if form closed | Excel Programming | |||
close user form | Excel Programming | |||
Close user form when button is pressed | Excel Programming | |||
Open Only the User Form ... or Close Everything ! | Excel Programming |