tf37
Board Regular
- Joined
- Apr 16, 2004
- Messages
- 169
This macro works for the most part, but what happens is it doesn’t completely rename the entire sheet.
If the sheet name is “Sheet1” and you run the macro, it renames it to “Sheet71 1”
What am I missing here to get it to just rename the Sheet1 to Sheet71 without leaving the 1 after the rename?
If steps to the next sheet, like Sheet2 and renames it Sheet72 2 and so on.
Sub RenameSheets()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name Like "Sheet#*" Then
ws.Name = Replace(ws.Name, "Sheet", "Sheet71 ", 1, 1)
End If
Next ws
End Sub
If the sheet name is “Sheet1” and you run the macro, it renames it to “Sheet71 1”
What am I missing here to get it to just rename the Sheet1 to Sheet71 without leaving the 1 after the rename?
If steps to the next sheet, like Sheet2 and renames it Sheet72 2 and so on.
Sub RenameSheets()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Name Like "Sheet#*" Then
ws.Name = Replace(ws.Name, "Sheet", "Sheet71 ", 1, 1)
End If
Next ws
End Sub