Home |
Search |
Today's Posts |
#1
|
|||
|
|||
sort tabs in a workbook other than one at a time with move or cop.
is there any way to sort worksheets other than using the move or copy option?
How to alphabetize multiple sheets at one time. |
#2
|
|||
|
|||
Try this:
Sub Sort_Active_Book() Dim i As Integer Dim j As Integer Dim iAnswer As VbMsgBoxResult ' Prompt the User as to which direction they want to sort the worksheets. iAnswer = MsgBox("Sort sheets in Ascending Order?" & Chr (10) & "Clicking NO will sort in DESCENDING order", vbYesNoCancel + vbQuestion + vbDefaultButton1, "Sort Worksheets") For i = 1 To Sheets.Count For j = 1 To Sheets.Count - 1 ' If answer is YES, sort ASCENDING If iAnswer = vbYes Then If UCase$(Sheets(j).Name) UCase$(Sheets(j + 1).Name) Then Sheets(j).Move After:=Sheets(j + 1) End If ' If Answer is NO, sort DESCENDING If iAnswer = vbNo Then If UCase$(Sheets(j).Name) < UCase$(Sheets(j + 1).Name) Then Sheets(j).Move After:=Sheets(j + 1) End If Next j Next i End Sub It's not mine but it works Good luck! -----Original Message----- is there any way to sort worksheets other than using the move or copy option? How to alphabetize multiple sheets at one time. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
sort tabs in a workbook other than one at a time with move or cop. | Excel Worksheet Functions | |||
Stubborn toolbars in Excel | Excel Discussion (Misc queries) | |||
move the worksheet tabs in a workbook to left | Excel Discussion (Misc queries) | |||
In Excel can I move the tabs to the left side of the workbook? | Excel Worksheet Functions | |||
Workbook Tabs | Excel Discussion (Misc queries) |