View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Command Button Caption

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

--
Regards,
Tom Ogilvy

"Qaspec" wrote in message
...
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!