I found this code in the forum and am trying to use it to rename a particular tab in by workbook. The problem is it is trying to rename every tab or worksheet I have and I only need it to change the name of 1 sheet. how can I modify the code to only name the one tab?
Sub tabname()
Dim ws As Worksheet
For Each ws In Worksheets
On Error Resume Next
If Len(ws.Range("B17")) >0 Then
ws.Name = ws.Range("B17").Value
End If
On Error Goto 0
If ws.Name <> ws.Range("B17").Value Then
Msgbox ws.Name & " Was Not renamed, the suggested name was invalid"
End If
Next
End Sub
Sub tabname()
Dim ws As Worksheet
For Each ws In Worksheets
On Error Resume Next
If Len(ws.Range("B17")) >0 Then
ws.Name = ws.Range("B17").Value
End If
On Error Goto 0
If ws.Name <> ws.Range("B17").Value Then
Msgbox ws.Name & " Was Not renamed, the suggested name was invalid"
End If
Next
End Sub