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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,224,749
Messages
6,180,725
Members
452,995
Latest member
isldboy

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