Shadé has attended:
Excel Intermediate course
Tabs
Is it possible when adding new tab where there are already tabs numbered in a sequence for the tbs to adapt to the new number that is added. So if I added a tab in between tabs labelled 1 and 2 and named the new tab 2 is there a way to automatically relabel all the following tabs instead of going in and having to manually change every tab.
RE: Tabs
Hi Shadé,
Thank you for the forum question.
You can achieve this in Excel using a bit of VBA (Visual Basic for Applications) scripting. Here’s a simple script that will automatically renumber your tabs when you insert a new one:
Press Alt + F11 to open the VBA editor.
Insert a new module by clicking Insert > Module.
Copy and paste the following code into the module:
Sub RenumberTabs()
Dim ws As Worksheet
Dim i As Integer
i = 1
For Each ws In ThisWorkbook.Worksheets
ws.Name = i
i = i + 1
Next ws
End Sub
Close the VBA editor.
Run the script by pressing Alt + F8, selecting RenumberTabs, and clicking Run.
This script will go through all the worksheets in your workbook and rename them sequentially starting from 1. If you insert a new tab and run the script again, it will automatically adjust the numbering.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector