View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] RJQMAN@gmail.com is offline
external usenet poster
 
Posts: 46
Default 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