PC Review


Reply
Thread Tools Rate Thread

Asigning code to Button with Macro

 
 
Pablo
Guest
Posts: n/a
 
      11th Oct 2006
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 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
Macro code behind button bcm2 Microsoft Excel Worksheet Functions 1 13th Jan 2010 06:13 PM
Macro to add button w/code to new worksheet PJ Microsoft Excel Programming 2 18th Feb 2009 05:25 PM
Voting button macro code kd Microsoft Outlook VBA Programming 3 24th Apr 2008 02:35 PM
Re: Excel 2003, trouble asigning a macro to a buttom Chip Pearson Microsoft Excel Misc 1 6th May 2004 09:06 PM
how to add code programmatically to a macro for a button Tina Microsoft Excel Programming 0 26th Aug 2003 03:30 AM


Features
 

Advertising
 

Newsgroups
 


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