ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Asigning code to Button with Macro (https://www.excelbanter.com/excel-programming/374927-asigning-code-button-macro.html)

Pablo

Asigning code to Button with Macro
 
I have a macro that create a button. I want to add code to control that
button with the same macro that creates the button. Each time the macro
creates a button, it adds a module where it puts the text (code).

Sub ButtonName_Click()
End Sub

I would like to add code between the lines as follows

Application.ScreenUpdating = False
Sheets("MSBs").Visible = True
ActiveWindow.SelectedSheets.Visible = False
Application.ScreenUpdating = True

So when the button is pressed this code runs. I have worked at it for
days now without asking for help but I can't figure it out. Any
suggestions? Thanks.



All times are GMT +1. The time now is 09:51 AM.

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