J
Jack_Feeman
I have placed a commandbutton (the system appropriately named it
CommandButton1) on Sheet 1. When clicked it brings up UserForm1. In the
UserForm I placed another CommandButton which the system appropriately named
CommandButton2. I added the following code in the editor:
"Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub"
It works fine. When you click the button on Sheet 1 it opens the UserForm.
Then when you are done referring to the form you click the commanbutton on
the form (appropriately labeled by me as OK) and the UserForm closes.
The problem is when I start repeating this for 10 more buttons on sheet 1
and 10 more userforms all to react the same way. The code for the first 2
look like this:
"
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton3_Click()
UserForm2.Show
End Sub
Private Sub CommandButton4_Click()
UserForm2.Hide
End Sub"
The problem: the first button and form work fine. The second and subsequent
buttons/forms display but do not go away when the form button is pushed only
when the Cancel (Red X) is pushed.
How can I get "all" the form buttons to close the form window as the first
one does?
Thanks Jack
CommandButton1) on Sheet 1. When clicked it brings up UserForm1. In the
UserForm I placed another CommandButton which the system appropriately named
CommandButton2. I added the following code in the editor:
"Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub"
It works fine. When you click the button on Sheet 1 it opens the UserForm.
Then when you are done referring to the form you click the commanbutton on
the form (appropriately labeled by me as OK) and the UserForm closes.
The problem is when I start repeating this for 10 more buttons on sheet 1
and 10 more userforms all to react the same way. The code for the first 2
look like this:
"
Private Sub CommandButton1_Click()
UserForm1.Show
End Sub
Private Sub CommandButton2_Click()
UserForm1.Hide
End Sub
Private Sub CommandButton3_Click()
UserForm2.Show
End Sub
Private Sub CommandButton4_Click()
UserForm2.Hide
End Sub"
The problem: the first button and form work fine. The second and subsequent
buttons/forms display but do not go away when the form button is pushed only
when the Cancel (Red X) is pushed.
How can I get "all" the form buttons to close the form window as the first
one does?
Thanks Jack