Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 50
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.misc
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with radio button Diana Excel Discussion (Misc queries) 1 July 17th 06 09:29 PM
radio button help tjb Excel Worksheet Functions 1 September 27th 05 11:51 PM
"RADIO BUTTON" Ian Shere Excel Discussion (Misc queries) 1 July 4th 05 10:59 PM
How do I lock a radio button group if a N/A button is selected worry a lot Excel Discussion (Misc queries) 2 May 21st 05 08:33 PM
VBA: Disable Frame and Radio Buttons based on Another Radio Button Being True Mcasteel Excel Worksheet Functions 2 October 29th 04 07:06 PM


All times are GMT +1. The time now is 12:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"