VBA TIPS
  Sorting worksheet by their name in ascending


Here is an example for sorting worksheet by their name in ascending.



Example

Place the following in a standard module.

Option Explicit

Sub SortingWks()
    Dim i As Long
    Dim j As Long
    For i = 1 To Worksheets.Count
        j = i
        Do While j > 1
            If Worksheets(j).Name < Worksheets(j - 1).Name Then
                Worksheets(j).Move Before:=Worksheets(j - 1)
            End If
            j = j - 1
        Loop
    Next
End Sub

| HOME |
Copyright © cellmasters.net - colo's junk room All Right Reserved
Tips and Information about Microsoft Excel|Masaru Kaji aka Colo