Excel Daily News

Search MrExcel

naming worksheet tabs

1.) Is it possible for a worksheet tab to be linked to a cell value so that the tab will have the same name as the cell value?

2.) If #1 is possible, how is this achieved?

thanks in advance for any help...rm

Posted by Lewis (1) on December 21, 2001 9:10 PM

I'm not sure if this is what you want but it is possible to name a cell, so that you can hyperlink to it as a bookmark. Obviously you can give the cell the same name name as the worksheet.

To name the cellSelect the cell you wish to name.In the top left hand corner is a box with the cell address in it.Click on this and you can then edit it.type in the name you want and press enter.This names the cell.

For Each MySh In Worksheets If MySh.Name = Sh.Range("A1").Value _ And Not MySh Is Sh Then Application.Undo MsgBox "Cannot Have Two Sheets with the same name, please rename.", vbCritical Exit Sub End If Next

If Not Sh.Name = Sh.Range("A1").Value _ And Not Sh.Range("A1").Value = "" Then Sh.Name = Sh.Range("A1").Value End IfEnd Sub

This code assumes that the worksheet name will be in cell A1, you can change it to whatever you want.

Posted by Mark O'Brien on December 21, 2001 9:18 PM

PS

The code doesn't check if the name contains invalid characters. Like "\" for example. For Each MySh In Worksheets If MySh.Name = Sh.Range("A1").Value _ And Not MySh Is Sh Then Application.Undo MsgBox "Cannot Have Two Sheets with the same name, please rename.", vbCritical Exit Sub End If Next If Not Sh.Name = Sh.Range("A1").Value _ And Not Sh.Range("A1").Value = "" Then Sh.Name = Sh.Range("A1").Value End If

Posted by rm on December 22, 2001 11:46 PM

Happy Holidays...

...much mahalo (thank you) for the help and have a happy holiday season!!!

(12 responses) HI! I am using a vlookup/match to populate fields from column headers. For the most part it's doing exactly what I need except instead of pu

Let's Connect

MrExcel.com debuted on November 21, 1998.

MrExcel.com provides examples of Formulas, Functions and Visual Basic procedures
for illustration only, without warranty either expressed or implied, including
but not limited to the implied warranties of merchantability and/or fitness for
a particular purpose. The Formulas, Functions and Visual Basic procedures on this
web site are provided "as is" and we do not guarantee that they can be used in all
situations.
This site contains affiliate links. Any affiliate commissions that we
earn when you click a link to Amazon or other sites is reinvested in keeping MrExcel.com
running. You can earn a commission for sales leads that you send to us by joining our
affiliate program.
View our Privacy Policy, Cookies Policy, and Terms of Use.