View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pablo Pablo is offline
external usenet poster
 
Posts: 9
Default 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.