Edit All Sheet names to remove numbers

Ash k

New Member
Joined
Aug 29, 2024
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a file which automatically generates 100 sheets of different brands. The system was updated and now all the sheets include a "- (462," at the beginning of the brand names.

Previously this would just be (Armani) but now it is - (462, Armani)

Could you let me know how I could just make it "Armani" or "(Armani)" for example


I would really appreciate any help!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
You can try something like this. It will loop through each sheet and replace (462, with (

VBA Code:
Private Sub RemoveGarbage()
Dim s As Worksheet

For Each s In Worksheets
    If Left(s.Name, 5) = "(462," Then
        s.Name = Replace(s.Name, "(462, ", "(")
    End If
Next s
End Sub
 
Upvote 1
Hi
untested but see if this will do what you want

VBA Code:
Sub Remove462()
    Dim ws As Worksheet
    
    For Each ws In ThisWorkbook.Worksheets
        If ws.Name Like "*462*" Then
            ws.Name = Replace(Replace(Replace(Replace(Replace(Replace(ws.Name, "462", ""), ",", ""), " ", ""), "-", ""), "(", ""), ")", "")
        End If
    Next ws
End Sub

Dave
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top