ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   GoTo Worksheet based on which button clicked (https://www.excelbanter.com/excel-programming/302853-goto-worksheet-based-button-clicked.html)

Paul Martin

GoTo Worksheet based on which button clicked
 
Hi All

I would like to write one routine that handles navigation to different
worksheets based on the name assigned to a button.

- I have a number of navigation buttons on a worksheet (the buttons
are from the Forms toolbar)
- Each button will navigate to a different worksheet
- I have given each button a different name, which is the same name as
the worksheet that it goes to
- For example, the button that goes to Worksheets("TestSheet") has the
name "TestSheet"
- The worksheet with the buttons is protected (so the buttons cannot
be selected)

What I don't know, is how to capture Shapes("TestSheet").Name when it
is clicked. I'd prefer not to have a whole case statement, if
possible.

All suggestions appreciated.

Paul Martin
Melbourne, Australia

Bob Phillips[_6_]

GoTo Worksheet based on which button clicked
 
Hi Paul,

Use

MsgBox Application.Caller


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Paul Martin" wrote in message
om...
Hi All

I would like to write one routine that handles navigation to different
worksheets based on the name assigned to a button.

- I have a number of navigation buttons on a worksheet (the buttons
are from the Forms toolbar)
- Each button will navigate to a different worksheet
- I have given each button a different name, which is the same name as
the worksheet that it goes to
- For example, the button that goes to Worksheets("TestSheet") has the
name "TestSheet"
- The worksheet with the buttons is protected (so the buttons cannot
be selected)

What I don't know, is how to capture Shapes("TestSheet").Name when it
is clicked. I'd prefer not to have a whole case statement, if
possible.

All suggestions appreciated.

Paul Martin
Melbourne, Australia




Paul Martin

GoTo Worksheet based on which button clicked
 
Thanks, Bob. Brilliant.

Paul



"Bob Phillips" wrote in message ...
Hi Paul,

Use

MsgBox Application.Caller


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Paul Martin" wrote in message
om...
Hi All

I would like to write one routine that handles navigation to different
worksheets based on the name assigned to a button.

- I have a number of navigation buttons on a worksheet (the buttons
are from the Forms toolbar)
- Each button will navigate to a different worksheet
- I have given each button a different name, which is the same name as
the worksheet that it goes to
- For example, the button that goes to Worksheets("TestSheet") has the
name "TestSheet"
- The worksheet with the buttons is protected (so the buttons cannot
be selected)

What I don't know, is how to capture Shapes("TestSheet").Name when it
is clicked. I'd prefer not to have a whole case statement, if
possible.

All suggestions appreciated.

Paul Martin
Melbourne, Australia



All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com