Change value without opeing tab

judgejustin

Board Regular
Joined
Mar 3, 2014
Messages
142
I am using the following code to change the name of a tab dependent on cell values. However it only updates if I leave the tab and come back to it. I would like it to update immediately upon the information in the cells changing.
Rich (BB code):
Private Sub Worksheet_Activate()
ActiveSheet.Name = ("Stage 1 #1  ") & ("(") & ActiveSheet.Range("B8") & ("-") & ActiveSheet.Range("C8") & (")")
     
End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
How about
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   If Target.CountLarge > 1 Then Exit Sub
   If Not Intersect(Target, Range("B8:C8")) Is Nothing Then
      ActiveSheet.Name = ("Stage 1 [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL]   ") & ("(") & ActiveSheet.Range("B8") & ("-") & ActiveSheet.Range("C8") & (")")
   End If
End Sub
 
Upvote 0
How are B8 & C8 being changed?
Manually, data validation, Formulae?
 
Upvote 0
OK, how about
Code:
Private Sub Worksheet_Calculate()
   ActiveSheet.Name = ("Stage 1 [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1]#1[/URL]    ") & ("(") & ActiveSheet.Range("B8") & ("-") & ActiveSheet.Range("C8") & (")")
End Sub
This will fire every time the sheet calculates
 
Upvote 0
For some reason this is now interfering with another macro that is running. It is trying to rename a sheet that opens with that other macro. I will just keep it the way it is. Thank you for the code though I have it saved because I plan to use it on a different sheet that doesn't have these other macros running on them.
 
Upvote 0

Forum statistics

Threads
1,223,705
Messages
6,173,985
Members
452,540
Latest member
haasro02

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