Option Buttons don't update

BrianExcel

Well-known Member
Joined
Apr 21, 2010
Messages
975
I have 5 option buttons. Each one sets a different image to "Visible = True" upon the click event.

Upon opening the form I can click each option button once and they will all display properly, BUT after the first click they don't update. It's almost as if they don't get set to false or something after updating.

Below is the code I am using currently. any ideas?

Code:
Private Sub optVelo_Click()
    
    If Me.optVelo.Value = True Then
        UserForm1.imgVelo.Visible = True
    End If
End Sub
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Not sure but option groups usually have a value corresponding to the index of the chosen button (such as 1,2,3,4, or 5 ... or if 0-based then 0,1,2,3 or 4).

Possibly you need to investigate the value of the option buttons - it would be instructive to use code like this:

Code:
Private Sub optVelo_Click()
    
    Msgbox Me.optVelo.Value

End Sub
If you see values such as 1 or 2 coming up, you need to not look for a "false" or "true" value for the option group, but work with the index values of the chosen option.

ξ
 
Upvote 0
I just figured it out...I had the sub set as click instead of change. As soon as I changed that the code worked.

Thanks though!
 
Upvote 0
It's almost as if they don't get set to false or something after updating.

You haven't told the code what to do if they're deselected.

Chip Pearson has a good function for evaluating Option Buttons in a group here.

And here's a good link for using Select Case.

HTH,
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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