View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Controlling Radio Button

Assuming that you are using a radio button from the Controls command
bar, not the Forms command bar and the linked cell is L13, both on
Sheet1, use the following code in the Sheet1 code module:

Public IgnoreEvent As Boolean
Private Sub OptionButton1_Click()
If IgnoreEvent = True Then
Exit Sub
End If
'''''''
' your normal code goes here
''''''''
End Sub

Then, in a regular code module, use

Sub AAA()
Sheet1.IgnoreEvent = True
Range("L13").Value = True
Sheet1.IgnoreEvent = False
End Sub

The IgnoreEvent = True will cause the OptionButton1_Click event code
to immediately exit without doing any work, then L13 is set to True
which checks the radio button, and then you set IgnoreEvent back to
False for normal behavior.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Tue, 27 Jan 2009 13:23:01 -0800, rk0909
wrote:

All,

Is it possible to NOT run a code associated with a radio button when the
linked cell is manually or programatically changed to TRUE.

In other words, I am trying to trigger a code when the user hits the radio
button, but in another scenario I want the to change the linked cell property
to TRUE while not running the associated code.

thanks much for your help.

R