Sorting sheets

  • Thread starter Thread starter emilija
  • Start date Start date
E

emilija

I have a book with a lot of sheets ( more then 200) , is it possible to
sort sheets in alphabetical order,
Thanks in advance
 
'sort all sheets in workbook
'on first letter of sheet name

Sub SortSheets()
Dim shCount, i, j As Long

shCount = Worksheets.Count

For i = 1 To shCount
For j = i + 1 To shCount
If Asc(Left(Worksheets(j).Name, 1)) < _
Asc(Left(Worksheets(i).Name, 1)) Then
Worksheets(j).Move Before:=Worksheets(i)
End If
Next j
Next i

End Sub

I hope, it is helpful.
 
Back
Top