Skip to content

Instantly share code, notes, and snippets.

@Tomamais
Created September 22, 2019 21:28
Show Gist options
  • Save Tomamais/7267c66e97a79497e8579db89372a622 to your computer and use it in GitHub Desktop.
Save Tomamais/7267c66e97a79497e8579db89372a622 to your computer and use it in GitHub Desktop.
Classificar Planilhas Alfabeticamente
'source: https://qr.ae/TWs7hb
'author: Chip Pearson
Sub SortWorksheets()
Dim i As Long, j As Long, n As Long
Dim ws As Worksheet
Application.ScreenUpdating = False
With ActiveWorkbook
n = .Worksheets.Count
If n > 1 Then
For i = 2 To n
For j = 2 To n
If .Worksheets(j).Name < .Worksheets(j - 1).Name Then .Worksheets(j).Move Before:=.Worksheets(j - 1)
Next
Next
End If
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment