naming tabs automated

O

officegirl

I need to name numerous tabs in a worksheet from one cell within that
worksheet, I have been retyping it , is there a way to copy it to the tab ?
 
G

Gary''s Student

This small macro assumes that the desired names are in cell A1 of each sheet:

Sub name_um()
For Each ws In Worksheets
ws.Name = ws.Range("A1").Value
Next
End Sub
 
J

JE McGimpsey

One way:

Put this in the ThisWorkbook code module of your workbook:


Private Sub Workbook_SheetChange( _
ByVal Sh As Object, _
ByVal Target As Excel.Range)
Dim sSheetName As String
With Target
If Not Intersect(.Cells, Range("A1")) Is Nothing Then
sSheetName = Range("A1").Text
If Not sSheetName = vbNullString Then
On Error Resume Next
Sh.Name = sSheetName
On Error GoTo 0
If Not sSheetName = Sh.Name Then _
MsgBox "Invalid worksheet name in cell A1"
End If
End If
End With
End Sub
 

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