-
Solved: Creating a Button For A Workbook Macro
I'm trying to make a button on the workbook that will activate a macro. I tried using Excel help but I still cant figure it out. I want this button to go with the workbook so others may use it when I send them the file. When you press the button I want it to call "Main" which runs the code.
[VBA]Public Sub Main()
Application.ScreenUpdating = False
Dim rngStart As Range
Set rngStart = Selection
Sheets("Tables").Activate
' Sheets("Tables").Select
First_Shift_Sort
Flex_Shift_Sort
Second_Shift_Sort
SD_Sort
With rngStart
.Parent.Activate
.Select
End With
Application.ScreenUpdating = True
End Sub
[/VBA]
Thanks
Gary
-
If you display the "Forms" toolbar, there is a button to create a command button, which you draw onto the worksheet. Once you've set the size and position of the button, it will prompt you for the name of the macro you want to link to.
-
Solved
Thank you geekgirl I was able to get it done your way.
-
Hey, geekgirlau, I tried out your suggestion (first time I've used the "Forms" toolbar), and the button is interesting, but perplexing. What kind of button is that? It doesn't seem to have the qualities of an AutoShape (which I prefer for buttons).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules