Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default XL2002: Button Labels & Sheets...

I have a 'menu sheet' in my workbook that contains several buttons which do
no more than select another sheet in the workbook. I am having to write a 1
line macro that selects the correct sheet for each button. The button labels
are the same as the sheet Tab names.

Is there a way that I can create 1 macro for all buttons that uses the
button label as a variable, and selects the relevant sheet?

I've been trying, but struggle with addressing the button label.

Thanks in advance

Trevor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default XL2002: Button Labels & Sheets...

Assuming you got your button from the Forms Toolbar then this code should do
it for you... Just Change the Sheets("Sheet1") to Sheets("???") where ??? is
the tab name of the sheet with the buttons on it...

Sub GoToSheet()
Sheets(Sheets("Sheet1").Buttons(Application.Caller ).Caption).Select
End Sub
--
HTH...

Jim Thomlinson


"Trevor Williams" wrote:

I have a 'menu sheet' in my workbook that contains several buttons which do
no more than select another sheet in the workbook. I am having to write a 1
line macro that selects the correct sheet for each button. The button labels
are the same as the sheet Tab names.

Is there a way that I can create 1 macro for all buttons that uses the
button label as a variable, and selects the relevant sheet?

I've been trying, but struggle with addressing the button label.

Thanks in advance

Trevor

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 181
Default XL2002: Button Labels & Sheets...

Excellent, thanks Jim

Trevor

"Jim Thomlinson" wrote:

Assuming you got your button from the Forms Toolbar then this code should do
it for you... Just Change the Sheets("Sheet1") to Sheets("???") where ??? is
the tab name of the sheet with the buttons on it...

Sub GoToSheet()
Sheets(Sheets("Sheet1").Buttons(Application.Caller ).Caption).Select
End Sub
--
HTH...

Jim Thomlinson


"Trevor Williams" wrote:

I have a 'menu sheet' in my workbook that contains several buttons which do
no more than select another sheet in the workbook. I am having to write a 1
line macro that selects the correct sheet for each button. The button labels
are the same as the sheet Tab names.

Is there a way that I can create 1 macro for all buttons that uses the
button label as a variable, and selects the relevant sheet?

I've been trying, but struggle with addressing the button label.

Thanks in advance

Trevor

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
XL2002 SUM with a twist... Trevor Williams Excel Worksheet Functions 4 December 9th 09 10:28 AM
Labels and chart sheets Revolveri Excel Discussion (Misc queries) 1 October 14th 08 01:06 PM
Toggling Button Labels Between Expand/Collapse [email protected] Excel Programming 1 December 15th 05 05:39 PM
Custom Button Labels JCanyoneer Excel Programming 1 April 4th 05 05:53 PM
Msgbox button labels Marcotte A[_2_] Excel Programming 4 June 8th 04 08:29 AM


All times are GMT +1. The time now is 01:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"