Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, this is my first post on Google groups, here goes, I have this
program that, given a lifespan of years say from 2004 to 2008, it creates a sheet for each year, then it creates a button for each sheet on the "Cover Sheet". What i'm trying to do is to get my program to assign a macro to each button that takes it to its corresponding sheet. I can get it to assign a macro to it but the macro doesn't know what sheet the button is supposed to send you to. I was thinking if i can read the name of the button put it into a variable in the little macro takes you to whatever page then do a Sheets().Select with the variable name in the parenthesis. Problem is I don't know how to read the buttons name. I just want one macro that can be flexible enough to take you to any sheet given the buttons name. Any help would be greatly appreciated, thank you. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The statement Application.Caller will return the name of
the button that called the procedure as a string; e.g. MsgBox Application.Caller will return the message "Button 1" if this is its name. Regards, Greg -----Original Message----- Hi, this is my first post on Google groups, here goes, I have this program that, given a lifespan of years say from 2004 to 2008, it creates a sheet for each year, then it creates a button for each sheet on the "Cover Sheet". What i'm trying to do is to get my program to assign a macro to each button that takes it to its corresponding sheet. I can get it to assign a macro to it but the macro doesn't know what sheet the button is supposed to send you to. I was thinking if i can read the name of the button put it into a variable in the little macro takes you to whatever page then do a Sheets ().Select with the variable name in the parenthesis. Problem is I don't know how to read the buttons name. I just want one macro that can be flexible enough to take you to any sheet given the buttons name. Any help would be greatly appreciated, thank you. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assigning A Macro to A Button | Excel Worksheet Functions | |||
assigning a macro to a button | Excel Discussion (Misc queries) | |||
assigning macro to button | Excel Discussion (Misc queries) | |||
Assigning macro to button | Excel Discussion (Misc queries) | |||
Automatically Assigning a Macro to a button | Excel Programming |