Hi
I have a code that Auto rename sheets based on text in cell which works fine (See below). However I would like the code to ignore any sheets that have already been named.
Sub tabname()
' Names each newley created tab with the scps name
Application.ScreenUpdating = False
Worksheets("PivotTables(1)").Activate
Dim ws As Worksheet
For Each ws In Worksheets
On Error Resume Next
If Len(ws.Range("P2")) > 0 Then
ws.Name = Replace(ws.Range("P2").Value, "/", "-")
End If
On Error GoTo 0
If ws.Name <> Replace(ws.Range("P2").Value, "/", "-") Then
MsgBox ws.Name & " Was Not renamed, the suggested name was invalid"
End If
Next
End Sub
Thanks
Richard