Controlling the order of Tabs

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,340
Office Version
  1. 365
Platform
  1. Windows
I have a Template where on occasion people have the need to add new tabs. But I want any new tables that are created always to be after the standard tabs that come with the template. Is there a way , using VBA to always put my standard Template Tabs upfront what the workbook opens (Automatically reorder the tabs - visually)? Example Sheet1, Sheet2, Sheet3... Should always be the first three tabs shown at the bottom of the workbook. Thanks for the help.

PS I don't always know what the user will name new tabs that they create and add to the workbook. I only know the names of the one in the template and the associate Sheet number.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
How about
VBA Code:
Private Sub Workbook_Open()
   Dim i As Long
   Dim Ary As Variant
   
   Ary = Array("Sheet1", "Sheet2", "Sheet3")
   For i = 0 To UBound(Ary)
      Sheets(Ary(i)).Move Sheets(i + 1)
   Next i
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

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