1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
Private Sub MiseAJourListe_Click()
'
Dim i As Integer, Lig As Integer, Col As Byte, k As Integer
Dim f1 As Worksheet, f2 As Worksheet
Set f1 = Worksheets("création des FIM")
Set f2 = Sheets("Classement par ordre alphabétiq")
'calcul du numéro de la premiere ligne vide
k = 3
Do While f1.Cells(k, 1) <> ""
k = k + 1
Loop
' Effacement de la feuille de classement
f2.Cells.Delete
'remplissage du tableau
Application.ScreenUpdating = False
For i = 1 To k - 1
f2.Cells(i, 1) = f1.Cells(i + 2, 2)
f2.Cells(i, 2) = f1.Cells(i + 2, 3)
f2.Cells(i, 3) = f1.Cells(i + 2, 1)
Next i
'largeur des colonnes du tableau
f2.Columns(1).ColumnWidth = 20
f2.Columns(2).ColumnWidth = 30
f2.Columns(3).ColumnWidth = 10
'mise en forme du tableau -> Plus rapide
f2.Range(f2.Cells(1, 1), f2.Cells(k - 3, 3)).Borders.Weight = Excel.XlBorderWeight.xlThin
f2.Range(f2.Cells(1, 1), f2.Cells(1, 3)).Font.Bold = True
'tri
' nombre de lignes du tableau
Lig = f2.Range("A2").SpecialCells(xlCellTypeLastCell).Row
f2.Range(f2.Rows(2), f2.Rows(Lig)).Sort Key1:=f2.Cells(2, 1), Key2:=f2.Cells(2, 2), Order1:=xlAscending, Order2:=xlAscending, Header:=xlNo
End Sub |
Partager