ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find and Replace Sheet names (https://www.excelbanter.com/excel-discussion-misc-queries/221899-find-replace-sheet-names.html)

FARAZ QURESHI

Find and Replace Sheet names
 
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
--

Best Regards,
FARAZ A. QURESHI

Sheeloo[_3_]

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

"FARAZ QURESHI" wrote:

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
--

Best Regards,
FARAZ A. QURESHI


Shane Devenshire[_2_]

Find and Replace Sheet names
 
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
--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"FARAZ QURESHI" wrote:

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
--

Best Regards,
FARAZ A. QURESHI



All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com