Excel tabs that are driven by cell values

Cirby

New Member
Joined
May 9, 2002
Messages
17
I'm using Excel 2003 and would like to have the tabs of each worksheet named by whatever is entered into cell C9 of the worksheet. I'm not sure if this will matter, but I've merged C9...E9. I'm if this is a repetitive question, I've searched the archives and am not finding the answer. Any guidance is appreciated.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Try this in the Workbook SheetChange event:

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo Invalid
If Target.Address = "$C$9" Then
    Sh.Name = Target
    Exit Sub
End If
Invalid:
MsgBox "Sheet name invalid", vbExclamation
End Sub
 
Upvote 0
I'm relatively inexperienced with this, so I apologize if you've already received this message. I gave your code a shot and it didn't work. Thanks for trying. I'm open to any other suggestions. Thanks again for the quick response.
 
Upvote 0
I also replied to your PM with this:

Right click on one of your sheet tabs. Click on View Code. On the left side of your screen, under VBA project (for your workbook) you will see that sheet selected, click on the ThisWorkbook in that same section, paste the code into the white area on the right.
Hit Alt-q.

When you save the workbook, this code will be saved with it.

If this doesn't do what you want, you will need to be more specific in what is not working
 
Upvote 0
Revised code:

Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo Invalid
If Target.Address = "$C$9" Then Sh.Name = Target
Exit Sub
Invalid:
MsgBox "Sheet name invalid", vbExclamation
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

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