Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Controlling Radio Button
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Controlling Radio Button
I bet you've seen application.enableevents in event code.
That's the setting will allow the developer to tell excel to stop looking for things that would cause an event to fire. You can do the same kind of thing if you keep track yourself. I used a commandbutton placed on a worksheet (Sheet1). This was the code in the worksheet module: Option Explicit Private Sub CheckBox1_Change() If BlkProc = True Then Exit Sub End If MsgBox Me.CheckBox1.Value End Sub Then I added this to a General module (not behind a worksheet and not behind ThisWorkbook): Option Explicit Public BlkProc As Boolean Sub testme() With Worksheets("sheet1").Range("a1") BlkProc = True .Value = Not .Value BlkProc = False End With End Sub The _Change event (or _Click if you use that) still fires, but the first thing the code does is look to see if it should continue or just exit. 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 -- Dave Peterson |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with radio button | Excel Discussion (Misc queries) | |||
radio button help | Excel Worksheet Functions | |||
"RADIO BUTTON" | Excel Discussion (Misc queries) | |||
How do I lock a radio button group if a N/A button is selected | Excel Discussion (Misc queries) | |||
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True | Excel Worksheet Functions |