Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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.

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
Macro code behind button bcm2 Excel Worksheet Functions 1 January 13th 10 06:13 PM
Asigning a value to words Tim Excel Discussion (Misc queries) 10 July 6th 07 05:46 PM
Code created in a Macro not working for a Command Button Amber_D_Laws[_8_] Excel Programming 15 January 13th 06 10:35 PM
Attaching a macro (module) code to button Todd Huttenstine[_2_] Excel Programming 1 December 29th 03 09:12 AM
how to add code programmatically to a macro for a button Tina Excel Programming 0 August 26th 03 03:30 AM


All times are GMT +1. The time now is 03:14 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"