Excel Macro to open Excel sheets in various sequences

Adreno

New Member
Joined
Jul 31, 2013
Messages
2
Hello, I am trying to make macros to unhide hidden sheets in different sequences then its original sequesces.

Example :

I have sheets Control Sheet,A,B,C,D,E,F,G & H

I want,
i) Button 1 to hide all sheets apart from Control sheet and then unhide and display in following sequence - C,E,A,B & F
ii) Button 2 to hide all sheets apart from Control sheet and then unhide and display in following sequence - A,B,H,G & C
iii) button 1 to hide all sheets apart from Control sheet and then unhide and display in following sequence - C,E,D,B,A& F

I have created macro but it doesnt display unhidden sheets in sequence I want but it displays in sequence original sheets had.

Please help !!!!!!!!!!!!!!!!!

Thank you
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Welcome to the forum, Indicated below is the code that will sort worksheets into an order. You can adapt it so that it unhides or hides if they aren't being named.

Sub SortWorksheets3()
Dim SortOrder As Variant
Dim Ndx As Long
SortOrder = Array("First", "Middle", "Last")
For Ndx = UBound(SortOrder) To LBound(SortOrder) Step -1
Worksheets(SortOrder(Ndx)).Move before:=Worksheets(1)
Next Ndx
End Sub
 
Upvote 0
Hi Trevor,

Thank you for your reply. I am very new to Excel so will you be kind and use sheet names A,B,C,D,E,F as shown in my example in the macro you have suggested. It will help me to understand and implement it easily. Thanks and sorry for trouble.

- Adreno
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,539
Members
449,038
Latest member
Guest1337

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