Quando a nossa aplicação gera novas abas com conteúdo no MS Excel, é importante que ordenemos o resultado. Como?
Sub SortALLSheets()'This module will sort all the worksheets present in active workbook.Dim iSheet As Long, iBefore As LongFor iSheet = 1 To ActiveWorkbook.Sheets.countSheets(iSheet).Visible = TrueFor iBefore = 1 To iSheet - 1If UCase(Sheets(iBefore).Name) > UCase(Sheets(iSheet).Name) ThenActiveWorkbook.Sheets(iSheet).Move before:=ActiveWorkbook.Sheets(iBefore)Exit ForEnd IfNext iBeforeNext iSheetEnd Sub