Me.ComboBox3.Value = .Cells(Me.ListBox1.ListIndex + 2, 3) ' Compte Tiers
.Cells(Me.ListBox1.ListIndex + 2, 3)
'6 Je souhaite gérer par code vba la création des comptes Tiers
'Le procédé se trouve dans la formule excel en colonne 3 comme suit:
=CONCATENER(GAUCHE([@Type];1);TEXTE(NB.SI($A$2:A21;$A21);"0000"))
With .ListBox1
.ColumnCount = 12
.ColumnWidths = "60;150;35;110;110;30;60;110;90;90;50;50"
.List = [Tableau4].Value
.ListIndex = 0 '------- >ici
End With
Sub TrierTiers()
Application.DisplayAlerts = False
With ActiveWorkbook.Worksheets("Plan Tiers")
With .ListObjects("Tableau4").Sort
With .SortFields
.Clear
.Add Key:=Range("Tableau4[Compte]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
End With
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub
With .ListBox1
.ColumnCount = 12
.ColumnWidths = "60;150;35;110;110;30;60;110;90;90;50;50"
.List = [Tableau4].Value
.ListIndex = 0 '------- >ici
End With
Sub TrierTiers()
Application.DisplayAlerts = False
With ActiveWorkbook.Worksheets("Plan Tiers")
With .ListObjects("Tableau4").Sort
With .SortFields
.Clear
.Add Key:=Range("Tableau4[Compte]"), SortOn:=xlSortOnValues, Order:= _
xlAscending, DataOption:=xlSortNormal
End With
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
ActiveWorkbook.Save
Application.DisplayAlerts = True
End Sub
.ListIndex=0
'ou
.List(L,.Columns.count-1)=1 +L
Dim L as Long 'cela dépend du nombre de lignes à traiter
.ListIndex=0