Bonjour,
Peut-on insérer une ligne dans un tableau après chaque changement de cette dernière ?
Ci-dessous le code.
Quand on double-clic sur A1 = tri colonne A.
Une fois le tri effectué, j'aimerais séparer les changements par une ligne vide.
Cela afin d'avoir mes numéros de colis (colonne A) bien séparés.
Mais dans un tableau je ne sais pas comment on fait.
Jai donc besoin de vos lumières
Merci
Ge0ffroy
Option Explicit
'--------------------------
'double clic sur A1= tri par colonneA
'double clic sur B1= tri par colonneB
'double clic sur C1= tri par colonneC
'double clic sur D1= tri par colonneD
'-------------------------------------
Private Sub Worksheet_BeforeDoubleClick(ByVal sel As Range, Cancel As Boolean)
Dim deb As Long
Application.ScreenUpdating = False
deb = Timer
If sel.Row > 1 Then Exit Sub
Cancel = True
With ActiveWorkbook.Worksheets("base").ListObjects("Tableau1").Sort
With .SortFields
.Clear
.Add Key:=Range("Tableau1[" & sel.Value & "]"), SortOn:=xlSortOnValues, _
Order:=xlAscending, DataOption:=xlSortNormal
End With
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
'Temps d'exécution de la macro affichée en F1
Range("F1").Select: ActiveCell.FormulaR1C1 = Timer - deb
End Sub