Rename Worksheet Tabs per Cell Content

G

Guest

Hello,

I'd like to be able to rename my worksheet tabs based on the contents of a
cell within that worksheet (same cell in each worksheet).

Any suggestions? TIA
 
G

Guest

Try something like this

dim aWS as worksheet
on error resume next
for each aWS in activeworkbook.worksheets
aws.name = aws.cells(1,1).value
next aws
on error goto 0

HTH,
Barb Reinhardt
 
G

Gord Dibben

From Ron de Bruin comes this code.

Sub Sheetname_cell()
Dim sh As Worksheet
Application.ScreenUpdating = False
For Each sh In ThisWorkbook.Worksheets
On Error Resume Next
sh.Name = sh.Range("A1").Value
'next lines cover duplicate names
If Err.Number > 0 Then
MsgBox "Change the name of : " & sh.Name & " manually"
Err.Clear
End If
On Error GoTo 0
Next
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top