ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Question about tab naming and referenced cells (https://www.excelbanter.com/excel-discussion-misc-queries/15974-re-question-about-tab-naming-referenced-cells.html)

Husker87

Question about tab naming and referenced cells
 
I have the same question but just want to link one worksheet tab name
automatically to a cell in the worksheet. Change the cell and the tab name
on the worksheet changes€¦ can you help with the VBA code for that? Many
Thanks€¦.


"JE McGimpsey" wrote:

One way:

Put this in your worksheet code module (right-click your worksheet tab
and choose View Code):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim i As Long
If Not Intersect(Target, Range("A4").Resize( _
Worksheets.Count, 1)) Is Nothing Then
On Error Resume Next 'in case invalid sheet name
For i = 2 To Worksheets.Count
Sheets(i).Name = Cells(i + 2, 1).Value
Next i
On Error GoTo 0
End If
End Sub

The update to references will occur automatically.


In article ,
"mbowen83" wrote:

Is there a way to have a certain worksheet assume the text in a cell (i.e.
sheet 2 renaming itself to whatever is in cell a4 of sheet 1, as well as
sheet 3 renamed to what is in a5 of sheet 1, and so forth), and then
automatically updating any reference to the renamed sheet throuhout the
workbook.



JE McGimpsey

Take a look he

http://www.mcgimpsey.com/excel/event...efromcell.html


In article ,
"Husker87" wrote:

I have the same question but just want to link one worksheet tab name
automatically to a cell in the worksheet. Change the cell and the tab name
on the worksheet changes€¦ can you help with the VBA code for that? Many
Thanks€¦.



All times are GMT +1. The time now is 09:10 PM.

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