Saturday, January 26, 2013

Sort Worksheet Tabs on Name

If you want to arrange /sort worksheet tabs on the name .Try this Macro



Sub sort_worksheet_by_name()

Dim i As Long
Dim j As Long

For i = 1 To Sheets.Count
    For j = i To Sheets.Count
        If UCase(Sheets(j).Name) < UCase(Sheets(i).Name) Then
              Sheets(j).Move Before:=Sheets(i)
         End If
    Next
Next


End Sub



Steps to Use
  • Copy the below code
  • Press Alt+F11 to open VBA editor
  • Paste it in any public module or module 1
  • Run the Macro

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...