Command Button Caption

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a comand button on sheet1. I'd like the caption on the button to
change depending on what is listed in cell a1 on sheet2. Thanks!
 
Use the calculate event for sheet2 if the value will change due to a formula

Right click on the sheet tab and select view code. Then in the resulting
module put in code similar to this.

Private Sub Calculate()
worksheets("Sheet1").CommandButton1.Caption = _
Me.Range("A1").Value
End Sub

If the cell must be manually edited to change then use the Change Event

Private Sub Worksheet_Change(ByVal Target As Range)
worksheets("Sheet1").CommandButton1.Caption = _
Me.Range("A1").Value
End Sub

Chip Pearson's page on events if not familiar with them

http://www.cpearson.com/excel/events.htm
 

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

Back
Top