Commandbutton caption change

P

peter.thompson

Still having problems with this.

I have a number of commandbuttons on a sheet that open up userforms.

Once the user has opened the form, i want the user to be able to change
the commandbutton caption, by entering the new caption into a text box.


The form textbox data is loaded into a sheet by the use of an 'Enter'
commabnbutton on the form

Any help welcome!

Peter (new to VBA)
 
D

Dave Peterson

I put a commandbutton on Sheet1 and used this code behind the Ok button on a
userform:

Option Explicit
Private Sub CommandButton1_Click()
Worksheets("Sheet1").CommandButton1.Caption = Me.TextBox1.Value
End Sub
 
L

Leith Ross

Hello Peter,

Which type of Command Button are you using on the Worksheet? Forms or
Control Toolbox?

Sincerely,
Leith Ross
 
G

Guest

These command buttons, did they come from the Forms toolbar or from the
control toolbox. They are different and the solution will have to be tailored
to the button type that you have.
 
G

Guest

Assuming that the command button is on Sheet1 (Code Name) and you added a
command button without changing the Name.

Sheet1.Commandbutton1.Caption = "Tada"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top