PC Review


Reply
Thread Tools Rate Thread

Code to assign a macro to hundreds of option buttons at once

 
 
Carl
Guest
Posts: n/a
 
      14th Nov 2008
I have hundreds of option buttons that need to have the same macro assigned
to each (too many to do manually). I am doing this so that when a button is
selected it will change a cell in the worksheet and run a worksheet change
macro. Thanks in advance!
 
Reply With Quote
 
 
 
 
Peter T
Guest
Posts: n/a
 
      14th Nov 2008
If you want to assign the same macro to all (Forms style) optionbutons on
the sheet, simply

ActiveSheet.OptionButtons.OnAction = "myMacro"

Otherwise you will need to loop option buttons looking for something
particular about one of the properties to dictate the OnAction string.

In passing, if you mean call worksheet change event code I doubt that's the
best approach.

Regards,
Peter T


"Carl" <(E-Mail Removed)> wrote in message
news3A65683-1006-44B2-A3D3-(E-Mail Removed)...
>I have hundreds of option buttons that need to have the same macro assigned
> to each (too many to do manually). I am doing this so that when a button
> is
> selected it will change a cell in the worksheet and run a worksheet change
> macro. Thanks in advance!



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I assign button/buttons to XL 2007 by Macro for different Iraj Microsoft Excel Worksheet Functions 0 9th Mar 2009 03:49 PM
Assign different buttons by Macro Iraj Microsoft Excel Misc 4 8th Mar 2009 01:31 AM
there's no assign macro option for command buttons?? frustrated Microsoft Excel Crashes 1 7th Jan 2009 07:00 AM
How to assign different Linked cells to option buttons furbiuzzu Microsoft Excel Programming 2 22nd Nov 2006 03:42 AM
How to assign same code inside Option button code space ?? furbiuzzu Microsoft Excel Programming 1 21st Nov 2006 02:36 PM


Features
 

Advertising
 

Newsgroups
 


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