Still cant figure this one out???

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??

--------------------------------------------------------------------------------

Jack in the UK
Board Master

Joined: Feb 17, 2002
Posts: 153
From: South London (Streatham / Brixton)
Posted: 2002-03-10 15:31
--------------------------------------------------------------------------------
Hi

Try:

Unload MyUserForm

try after each not just at end so will act as kill.

_________________
Good Luck
HTH

Rdgs
==========
Jack in the UK

--------------------------------------------------------------------------------

Anonymous
Unregistered User Posted: 2002-03-10 15:55
--------------------------------------------------------------------------------
Still doesnt work.


Sub CommandButton3_Click()
Me.Hide

'On Error Resume Next
'If OptionButton1.Value = True Then Me.Hide
If OptionButton1.Value = True Then Call Module1.sheet1
Unload Me
'On Error GoTo 0
'On Error Resume Next
'If OptionButton2.Value = True Then Me.Hide
If OptionButton2.Value = True Then Call Module1.sheet2
Unload Me
'On Error GoTo 0
'On Error Resume Next
'If OptionButton3.Value = True Then Me.Hide
If OptionButton3.Value = True Then Call Module1.sheet3
Unload Me
'On Error GoTo 0
'On Error Resume Next
'If OptionButton4.Value = True Then Me.Hide
If OptionButton4.Value = True Then Call Module1.sheet4
Unload Me
'On Error GoTo 0

Unload Me
End Sub


Any other sugestions?????
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top