Renaming Multiple Tabs

Pete122

New Member
Joined
Aug 20, 2018
Messages
3
I have hundreds of tabs in an excel file all labeled with #1 and so on. How would I go about renaming all the tabs in one go to just getting them numbered such as 1, 2, 3, ...
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi & welcome to the board.
How about
Code:
Sub renameTabs()
   Dim Ws As Worksheet
   
   For Each Ws In Worksheets
      If Left(Ws.Name, 1) = "#" Then Ws.Name = Replace(Ws.Name, "#", "")
   Next Ws
End Sub
 
Upvote 0
Hi & welcome to the board.
How about
Code:
Sub renameTabs()
   Dim Ws As Worksheet
   
   For Each Ws In Worksheets
      If Left(Ws.Name, 1) = "#" Then Ws.Name = Replace(Ws.Name, "#", "")
   Next Ws
End Sub

It worked beautifully. Thanks for the help
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0
Another question since you were able to help me out big time. I'm running into a problem when I try to reference the same cell, but in different sheets. Whenever I type the equation for the reference, =1!$A$1, I drag it down to repeat the process so that it does the 2nd sheet and so on, but excel automatically adds single quotes around the 1 and locks the 1 in the equation causing it to repeat the equation with no change. What can I do to fix this issue? I copied and pasted my excel sheet below because the forum wont let me upload my file. (The other sheets are labeled as 1,2,3,4,5,6,7,8,9).
true/false
1='1'!$A$1
2='1'!$A$1
3='1'!$A$1
4='1'!$A$1
5='1'!$A$1
6='1'!$A$1
7='1'!$A$1
8='1'!$A$1
9='1'!$A$1



<colgroup><col width="64" style="width: 48pt;" span="3"> <tbody> </tbody>
 
Upvote 0
Not sure you can "fix it", because the sheet name is numerical it needs to be enclosed it in single quotes.
 
Upvote 0

Forum statistics

Threads
1,217,364
Messages
6,136,114
Members
449,993
Latest member
Sphere2215

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