ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to assign same code inside Option button code space ?? (https://www.excelbanter.com/excel-programming/377834-how-assign-same-code-inside-option-button-code-space.html)

furbiuzzu

How to assign same code inside Option button code space ??
 
Hi all,

I've to assign the same VB code to all of my 200 option buttons inside
a sheet.
Do i have to write it manually for all buttons???

thanks for your help.


JLGWhiz

How to assign same code inside Option button code space ??
 
Here is one way:

Private Sub CommandButtonName_Click()
'Do something
myMacro
End Sub

Sub myMacro()
'Do events, etc.
End Sub

Attach the Private Sub to the command button and put the macro you want to
run in the general code module. When you click the button it does whaterver
you had it there for plus it calls the myMacro from the general module.

"furbiuzzu" wrote:

Hi all,

I've to assign the same VB code to all of my 200 option buttons inside
a sheet.
Do i have to write it manually for all buttons???

thanks for your help.




All times are GMT +1. The time now is 03:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com