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
| Private Sub FRM_BTN_Contacts_Emails_Sort_Click()
Dim S As Worksheet
Dim R As Range
' je sélectionne l'onglet
Set S = Sheets("Contacts")
' je séléctionne la région à trier
Set R = Sheets("Contacts").[a1].CurrentRegion
' paramètres du tri
With S.Sort
.SortFields.Clear
.SortFields.Add Range("A1"), xlSortOnValues, xlAscending, xlSortNormal
.SetRange R ' R s'est vu attribué une zone plus haut
.Header = xlYes
.MatchCase = False
.Orientation = xlSortColumns
.Apply
End With
' Je libère de la mémoire
Set S = Nothing
Set R = Nothing
End Sub |
Partager