G
Guest
Guest
Hi-
I designed a project with about 24 userforms. Most of them assign a value to a spreadsheet. The others are for the purpose of selecting a choice to show another userform(By way of a module). Im using optionbutton controlls for these few. Heres the code for one of them:
Sub CommandButton3_Click()
'On Error Resume Next
If OptionButton1.Value = True Then Me.Hide
If OptionButton1.Value = True Then Call Module1.sheet1
'On Error GoTo 0
'On Error Resume Next
If OptionButton2.Value = True Then Me.Hide
If OptionButton2.Value = True Then Call Module1.sheet2
'On Error GoTo 0
'On Error Resume Next
If OptionButton3.Value = True Then Me.Hide
If OptionButton3.Value = True Then Call Module1.sheet3
'On Error GoTo 0
'On Error Resume Next
If OptionButton4.Value = True Then Me.Hide
If OptionButton4.Value = True Then Call Module1.sheet4
'On Error GoTo 0
Unload Me
End Sub
Heres the problem- when a certian sequence of userforms are promped to be shown or unloaded, the userforms with the optionbuttons hid and unload initialy, but come back (show) at some other point! If I dont use the error method, I get an error during the sequence, using the error method, the form just reappears. Ive tried everthing to pinpoint the problem. I replaced the optionbutton with a commandbutton to see the results and it works as it should. When I went back to using the optionbutton, I got an error. Im convinced its the way I wrote the code for the optionbuttons, but im not sure how to correct it- please help??
I designed a project with about 24 userforms. Most of them assign a value to a spreadsheet. The others are for the purpose of selecting a choice to show another userform(By way of a module). Im using optionbutton controlls for these few. Heres the code for one of them:
Sub CommandButton3_Click()
'On Error Resume Next
If OptionButton1.Value = True Then Me.Hide
If OptionButton1.Value = True Then Call Module1.sheet1
'On Error GoTo 0
'On Error Resume Next
If OptionButton2.Value = True Then Me.Hide
If OptionButton2.Value = True Then Call Module1.sheet2
'On Error GoTo 0
'On Error Resume Next
If OptionButton3.Value = True Then Me.Hide
If OptionButton3.Value = True Then Call Module1.sheet3
'On Error GoTo 0
'On Error Resume Next
If OptionButton4.Value = True Then Me.Hide
If OptionButton4.Value = True Then Call Module1.sheet4
'On Error GoTo 0
Unload Me
End Sub
Heres the problem- when a certian sequence of userforms are promped to be shown or unloaded, the userforms with the optionbuttons hid and unload initialy, but come back (show) at some other point! If I dont use the error method, I get an error during the sequence, using the error method, the form just reappears. Ive tried everthing to pinpoint the problem. I replaced the optionbutton with a commandbutton to see the results and it works as it should. When I went back to using the optionbutton, I got an error. Im convinced its the way I wrote the code for the optionbuttons, but im not sure how to correct it- please help??