Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Command Button Caption

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
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!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change caption of a button Dylan @ UAFC[_2_] Excel Worksheet Functions 3 November 25th 08 07:04 PM
Change Caption of Forms Command Button No Name Excel Programming 9 December 10th 04 07:59 AM
Option button caption Buce Roberson Excel Programming 1 August 26th 04 02:58 PM
Caption of a button Dr_Phil Excel Programming 4 May 4th 04 09:13 PM
Urgent: VBA Command Button Caption Problem Disco[_4_] Excel Programming 1 November 12th 03 10:38 AM


All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"