Name a sheet = to value in a cell

D

dbs

Is there a way to have the name on the worksheet tab show
the value in a particular cell. For example: I want the
sheet tab name to be the same as the customer name in Cell
A1 without having to type in the name for each
sheet/Customer
 
R

Ron de Bruin

Hi

Copy this in the Thisworkbook module

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Address = "$A$1" Then
If Target.Value <> "" Then
On Error Resume Next
Sh.Name = Target.Value
On Error GoTo 0
End If
End If
End Sub

If you change A1 in each sheet of the workbook the tab name will change to the cell value
 
G

Gord Dibben

dbs

Sub SheetName()
ActiveSheet.Name = Range("A1")
End Sub

Gord Dibben Excel MVP
 
Top