LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default Link button name to a cell

Thanks for all your help.
Neda

"OssieMac" wrote:

Hi Needa,

The best I have been able to come up with is to use the worksheet activate
event for the sheet which has the buttons because you only want the buttons
to be updated when you change back to that sheet. Each time you select the
worksheet with the buttons, the captions get updated.

You could either update the captions directly from the sheet names or from
the cells with the names in them.

Something you need to know is that each worksheet has a code name which is
not changed when you rename the worksheet. You can see them in the project
explorer part of the VBA editor. The names are Sheet1, Sheet2 etc and the
name that you can change is the one in brackets. However, you can still refer
to the worksheets by the code name as I have done in the code below because
that name never changes. Note that the code names are not the same as
Sheets(1), Sheets(2) etc which refer to the sheets from left to right in the
workbook.

In the code I have demonstrated changing the caption by copying the cell
reference and also directly copying the worksheet given name.

Private Sub Worksheet_Activate()
With Sheet1
.Cells(6, 3) = Sheet2.Name
.CommandButton2.Caption = .Cells(6, 3)
.Cells(10, 3) = Sheet3.Name
.CommandButton3.Caption = Sheet3.Name
.Cells(14, 3) = Sheet4.Name
.CommandButton4.Caption = Sheet4.Name
.Cells(18, 3) = Sheet5.Name
.CommandButton5.Caption = Sheet5.Name
End With
End Sub

Hope it helps.

Regards,

OssieMac




 
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
how to link a macro to a button on the excel sheet Neo Excel Discussion (Misc queries) 1 June 16th 06 05:04 PM
In Excel 2000 (9.0.3821 SR-1) there is no button Break Link coating engineer Excel Discussion (Misc queries) 1 March 22nd 06 05:50 PM
How to create a link by using command button in VB Dav Excel Discussion (Misc queries) 1 March 9th 06 12:23 PM
how do I link radio button selection to another page Sharon Excel Worksheet Functions 0 April 27th 05 09:29 PM
button link Marcel Excel Discussion (Misc queries) 1 March 17th 05 12:49 AM


All times are GMT +1. The time now is 12:45 PM.

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

About Us

"It's about Microsoft Excel"