Sheet Sorting with Hidden Sheets

northgate

New Member
Joined
May 28, 2015
Messages
2
Have an excel workbook with several data sheets in addition to 'Reports' that has to be in the 97-03 format.

I need to re-order only the visible sheets by putting the 'last report' at the front.

I've tried several suggestions found on here, but all of them fail with the following error:

Run Time Error 1004: "Move Method of the Worksheet Class Failed"

I've gotten the following Macro to work in the past for this, but it is also generating the same Run Time Error:

Sub BackToTheFuture()
Dim AllShts As Sheets
Dim N As Long
Dim C As Long
Set AllShts = ActiveWorkbook.Sheets
C = AllShts.Count
For N = 1 To (C - 1)
AllShts(C).Move Before:=AllShts(N)
Next
AllShts(1).Select
Set AllShts = Nothing
End Sub

I have a very elementary understanding of the macro functionality, so I'd appreciated any babysteps you could provide.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,207,392
Messages
6,078,219
Members
446,322
Latest member
pebuje

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