Find and Replace Sheet names

F

FARAZ QURESHI

Any idea/code for changing the names of worksheets' names in a single go!
For instance,
Converting sheet names like the following:

Sheet(1)
Sheet(2)
Sheet(3)
Sheet(4)
Sheet(5) ...

as follows:

Sheet-1
Sheet-2
Sheet-3
Sheet-4
Sheet-5 ...

Thanx in advance
 
S

Sheeloo

Use the macro
Sub rename_Sheets()
i = 1
For Each ws In Worksheets
ws.Name = "Sheet-" & i
i = i + 1
Next
End Sub
 
S

Shane Devenshire

Hi,

Here is another alternative which assumes that the sheets may not all be
number in order and that some of the sheets may not need to be renamed
because they aren't numbered in the said manner:

Sub Rename()
Dim ws As Worksheet
On Error Resume Next
For Each ws In Worksheets
ws.Name = Replace(Replace(ws.Name, "(", "-"), ")", "")
Next ws
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top