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

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

ML575

New Member
Joined
May 31, 2016
Messages
4
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,168
Messages
5,570,604
Members
412,330
Latest member
carlosjw
Top