ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Rename Worksheet Tabs per Cell Content (https://www.excelbanter.com/excel-programming/389446-rename-worksheet-tabs-per-cell-content.html)

Jeff

Rename Worksheet Tabs per Cell Content
 
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

Barb Reinhardt

Rename Worksheet Tabs per Cell Content
 
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
"JEFF" wrote:

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


Gord Dibben

Rename Worksheet Tabs per Cell Content
 
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

On Tue, 15 May 2007 09:52:01 -0700, JEFF wrote:

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




All times are GMT +1. The time now is 10:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com