PC Review


Reply
Thread Tools Rate Thread

Change Worksheet Button Caption on Worksheet.Activate

 
 
=?Utf-8?B?TWlrZVp6?=
Guest
Posts: n/a
 
      7th Dec 2006
Like the title says....
I want to change the text on a worksheet button when I activate the sheet.
I know how to do it in a dialog box but don't have a clue where to start.

In short, I have a list of projects in a column and have a button above the
column.

I have a cell that counts how many projects I list in a range.

I'd like to have the button say something like:
"Summarize X Projects"

where "X" is the count of the projects and gets updated with the correct
quantity whenever I add a project to the list.

Part of my problem is that I have no idea how to find out the name of the
button so I can call it so any resource explaining those kinds of things
would help.

Thanks,
 
Reply With Quote
 
 
 
 
John Green
Guest
Posts: n/a
 
      7th Dec 2006
It depends. There are two types of command buttons.

For a button created using the Forms toolbar, Ctrl+Click it or Right+Click
it to select it. The name of the button will be in the Name box at the top
left of the screen, where you can change it if you wish. Use code like the
following to change the caption of a button named Button 1 in Sheet1:


Sheet1.Buttons("Button 1").Caption = "XXX"

For a button created with the Control Toolbox toolbar, click the Design Mode
button on the Control Toolbox toolbar to enter design mode. Right+Click the
button and select Properties to see the buttons name and edit it if you
wish. You can then use code like the following to change the caption on a
button named CommandButton1 in Sheet1:

Sheet1.CommandButton1.Caption = "New Test"

John Green

"MikeZz" <(E-Mail Removed)> wrote in message
news:8F0A0D7C-06BC-4CB7-A2B6-(E-Mail Removed)...
> Like the title says....
> I want to change the text on a worksheet button when I activate the sheet.
> I know how to do it in a dialog box but don't have a clue where to start.
>
> In short, I have a list of projects in a column and have a button above
> the
> column.
>
> I have a cell that counts how many projects I list in a range.
>
> I'd like to have the button say something like:
> "Summarize X Projects"
>
> where "X" is the count of the projects and gets updated with the correct
> quantity whenever I add a project to the list.
>
> Part of my problem is that I have no idea how to find out the name of the
> button so I can call it so any resource explaining those kinds of things
> would help.
>
> Thanks,



 
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
Worksheet Change event not firing but Worksheet activate event does Raj Microsoft Excel Programming 1 21st Sep 2009 01:41 PM
Pass Worksheet Button Caption or Identifier to Sub RyanH Microsoft Excel Programming 9 17th Nov 2008 10:00 PM
creating a button to activate another worksheet within a workbook =?Utf-8?B?TWlja2V5amF5NzE=?= Microsoft Excel Programming 7 31st Oct 2007 03:24 PM
activate a worksheet formula through a button =?Utf-8?B?VFVOR0FOQSBLVVJNQSBSQUpV?= Microsoft Excel Misc 5 12th Nov 2005 09:28 AM
Activate Previous worksheet after adding a new worksheet Chingangel@yahoo.com Microsoft Excel Programming 3 19th Oct 2005 01:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:35 AM.