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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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).
[TABLE="width: 144"]
<colgroup><col width="64" style="width: 48pt;" span="3"> <tbody>[TR]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 64, bgcolor: transparent"]true/false[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]1[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]2[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]3[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]4[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]5[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]6[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]7[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]8[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]9[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]='1'!$A$1
[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]

[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: center"]
[/TD]
[/TR]
</tbody>[/TABLE]
 
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,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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