Sorting sheets

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
 
L

losmac

'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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top