ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I link the worksheet tab to a cell in the worksheet? (https://www.excelbanter.com/excel-worksheet-functions/16000-how-do-i-link-worksheet-tab-cell-worksheet.html)

Husker87

How do I link the worksheet tab to a cell in the worksheet?
 
I want to link the tab of the worksheet to a cell. I type in something
different into a cell and the tab at the bottom automatically changes... can
Excel do that for me?

Andy Brown

"Husker87" wrote in message
...
I want to link the tab of the worksheet to a cell. I type in something
different into a cell and the tab at the bottom automatically changes...

can
Excel do that for me?


A macro can. Rightclick the sheet tab, select "View Code". Paste this into
the worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo 100
If Selection.Cells.Count 1 Then Exit Sub
If Target = "" Then Exit Sub
If Target.Address = "$A$1" Then
ActiveSheet.Name = Target
End If
Exit Sub
100:
MsgBox "Invalid sheet name."
End Sub

Press ALT+Q to return to Excel.

NB: assumes "a cell" = A1.

HTH,
Andy



Andy Brown

Or you could just see the reply J E McGimpsey posted in misc, already.

:-[




All times are GMT +1. The time now is 07:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com