Problem disabling Form Control Button during macro

ML575

New Member
Joined
May 31, 2016
Messages
4
Hi,

I'm trying to disable a Form Control button if a certain Form Control Option Button is checked. The only problem is that the button won't disable, hence, allowing me to continue running the macro.

My code is as follows:

Dim optBtn66 As Excel.OptionButton
Set optBtn66 = Worksheets("Question 1").Shapes.Item("Option Button 66").OLEFormat.Object

If optBtn66.Value = 1 Then
MsgBox ("Correct! Move to the next question.")
Worksheets("Question 1").Range("I97") = "Correct!"
Worksheets("Question 1").Shapes.Item("Button 70").ControlFormat.Enabled = False
Else:
Worksheets("Question 1").Range("I97") = "Incorrect!"
Worksheets("Question 1").Shapes("Button 70").ControlFormat.Enabled = False
Worksheets("Q1ANS").Range("E43").Value = 2
MsgBox ("Incorrect. Move to the next question.")
End If

Thanks in advance!!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Thanks for your reply. Although i got this code to work and it's definitely an alternate option, i would much rather have the button disable.
 
Upvote 0

Forum statistics

Threads
1,223,157
Messages
6,170,419
Members
452,325
Latest member
BlahQz

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