Sub TabName()
Dim ws As Worksheet
For Each ws In Worksheets
On Error Resume Next
If Len(ws.Range("A2")) > 0 Then
ws.Name = Replace(ws.Range("A2").Value, "/", "-")
End If
On Error GoTo 0
If ws.Name <> Replace(ws.Range("A2").Value, "/", "-") Then
MsgBox ws.Name & " Was Not renamed, the suggested name was invalid"
End If
Next
End Sub
Option Explicit
Sub test()
' hiker95, 10/29/2013
' http://www.mrexcel.com/forum/excel-questions/735788-run-macro-all-worksheets-except-one.html
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "TEMPLATE" Then
On Error Resume Next
If Len(ws.Range("A2")) > 0 Then
ws.Name = Replace(ws.Range("A2").Value, "/", "-")
End If
Next ws
End Sub