PC Review


Reply
Thread Tools Rate Thread

Adding a button to run a macro to the worksheet

 
 
Bruce
Guest
Posts: n/a
 
      14th Nov 2006
I have done this in the past, but it has been several years...
How do you add a button to the work sheet to run a macro? I have one now on
the Toolbars, but I want one on the sheet it self so that I can distrubute
the sheet

Thanks
Bruce


 
Reply With Quote
 
 
 
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      14th Nov 2006
Hi
Manually:
Write the macro
View, Toolbars, Forms
Click on the "button" icon (top right?)
Draw the button on the sheet and assign the macro
If the macro is not written, right click the button when it is and
assign

in code, this will put a form button on cell A1

Dim myButton as Button
Dim myText as String
With Worksheets("mySheet").Range("A1")
Set myButton =
ActiveWorkbook.Worksheets("mySheet").Buttons.Add _
(.Left,
..Top, .Width, .Height)
End With
With DateButton
.Placement = xlMove
.Caption = myText
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.Orientation = xlhorizontal
.OnAction = "myMacro"
End With
Bruce wrote:

regards
Paul

> I have done this in the past, but it has been several years...
> How do you add a button to the work sheet to run a macro? I have one now on
> the Toolbars, but I want one on the sheet it self so that I can distrubute
> the sheet
>
> Thanks
> Bruce


 
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
Adding button to worksheet Bremser Microsoft Excel Programming 1 13th Mar 2008 06:35 PM
Adding Macro to Button on WOrksheet Barb Reinhardt Microsoft Excel Misc 1 21st Jan 2006 02:29 PM
Adding tool tip to worksheet button =?Utf-8?B?U3VlSkI=?= Microsoft Excel Programming 6 9th Dec 2004 08:07 PM
How to end macro on inital active worksheet containing macro button that was clicked =?Utf-8?B?U2lsdmVyaGF3azE=?= Microsoft Excel Programming 2 14th May 2004 03:58 PM
Adding a command button to my Excel worksheet bishy Microsoft Excel Programming 5 17th Mar 2004 07:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:26 AM.