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,
|