Sub tri_onglet()
Option Compare Text
Dim i As Integer, j As Integer, num As Integer, nom As String
Dim modeleIndex As Integer, planningIndex As Integer
modeleIndex = -1
planningIndex = -1
' Tri des onglets par ordre alphabétique
For i = 2 To Sheets.count
For j = i + 1 To Sheets.count
If UCase(Sheets(j).Name) < UCase(Sheets(i).Name) Then
Sheets(j).Move before:=Sheets(i)
End If
Next j
Next i
' Trouver les index de "modele" et "PLANNING"
For i = 1 To Sheets.count
If Sheets(i).Name = "modele" Then
modeleIndex = i
ElseIf Sheets(i).Name = "PLANNING" Then
planningIndex = i
End If
Next i
' Déplacer "modele" au début
If modeleIndex > 0 Then
Sheets(modeleIndex).Move before:=Sheets(1)
End If
' Déplacer "PLANNING" après "modele"
If planningIndex > 0 Then
Sheets(planningIndex).Move after:=Sheets(1)
End If
End Sub