• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Rename sheet based on cell value

Jet Fusion

Member
Hi

How would I add a specific sheet (sheet 1) to this code. The sheet (sheet 1) that will have the data will be on a seperate sheet (sheet 1) than the sheet (sheet 2) I want renamed.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
If IsEmpty(Target) Then Exit Sub

Thanks
 
Hello ..try this Code
Code:
Sub tabname()
Dim ws As Worksheet
For Each ws In Worksheets
    With ws
        If .Range("A1").Value <> "" Then .Name = .Range("A1").Value
    End With
Next ws
End Sub
or this one
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Address(False, False) = "A1" Then
    On Error Resume Next
    Me.Name = Target.Value
    On Error GoTo 0
End If
End Sub
and if you mak Search you can to Found what you want here
VBA code to change the sheet name based on cell value
 
Back
Top