Updating tab name by cell reference

LauchB

New Member
Joined
Nov 11, 2015
Messages
9
Hello,

I have entered the following code into the tab view code field and it works well when I manually change this field. However D1 references another sheet and when I change it in the other sheet D1 changes, but not the sheet tab name, ideas?



Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "D1" Then Me.Name = "Report Summary " & Target.Value
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Put it a Worksheet_Calulate event rather than a Worksheet_Change event maybe.
 
Upvote 0
Hey,

What does D1 reference exactly in your report summary tab? You could set up 2 pieces of code with a worksheet change and a worksheet activate.

Example:

Lets say D1 in your summary tab references Sheet2!D1 then:

Sheet2 code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(False, False) = "D1" Then Sheets(1).Activate
    Sheets("Sheet2").Activate
End Sub

Sheet1 (report summary) code:
Code:
Private Sub Worksheet_Activate()
    Me.Name = "Report Summary " & Range("D1").Value
End Sub

Here I assume the report summary is the leftmost tab in the workbook
 
Last edited:
Upvote 0
Hey,

What does D1 reference exactly in your report summary tab? You could set up 2 pieces of code with a worksheet change and a worksheet activate.

Example:

Lets say D1 in your summary tab references Sheet2!D1 then:

Sheet2 code:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address(False, False) = "D1" Then Sheets(1).Activate
    Sheets("Sheet2").Activate
End Sub

Sheet1 (report summary) code:
Code:
Private Sub Worksheet_Activate()
    Me.Name = "Report Summary " & Range("D1").Value
End Sub

Here I assume the report summary is the leftmost tab in the workbook

Hi,

Thanks for this. D1 references a timeframe- eg 2020, then other "report summaries" work from that, 2020 -1 etc, I want each tab name updated. It is dynamic so you can also just pick a week and have this week, previous week etc.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top