Dim ligne, f
Dim tempoLig As Long '///ajout pmo
Private Sub UserForm_Initialize()
Set f = Sheets("LIVRAISONS")
Set mondico = CreateObject("Scripting.Dictionary")
For Each c In Range("B5:B" & [B65000].End(xlUp).Row)
mondico(c.Value) = ""
Next c
temp = mondico.keys
Me.ComboBox1.List = temp
j = 0
Me.ChoixArticle.Clear
derlig = f.[B10000].End(xlUp).Row
For Each c In f.Range("B5:B" & derlig)
Me.ChoixArticle.AddItem
Me.ChoixArticle.List(j, 0) = c
Me.ChoixArticle.List(j, 1) = c.Offset(0, 1)
Me.ChoixArticle.List(j, 2) = c.Offset(0, 3)
Me.ChoixArticle.List(j, 3) = c.Row
j = j + 1
Next c
ligne = 5
maj
End Sub
Private Sub ComboBox1_Change()
j = 0
Me.ChoixArticle.Clear
If Me.ComboBox1 <> "*" Then
derlig = f.[B10000].End(xlUp).Row
For Each c In f.Range("B5:B" & derlig)
If c.Value = Me.ComboBox1 Then
Me.ChoixArticle.AddItem
Me.ChoixArticle.List(j, 0) = c
Me.ChoixArticle.List(j, 1) = c.Offset(0, 1)
Me.ChoixArticle.List(j, 2) = c.Offset(0, 3)
Me.ChoixArticle.List(j, 3) = c.Row
If tempoLig = 0 Then tempoLig = c.Row '///ajout pmo
j = j + 1
End If
Next c
Else
derlig = f.[B10000].End(xlUp).Row
For Each c In f.Range("B5:B" & derlig)
Me.ChoixArticle.AddItem
Me.ChoixArticle.List(j, 0) = c
Me.ChoixArticle.List(j, 1) = c.Offset(0, 1)
Me.ChoixArticle.List(j, 2) = c.Row
Me.ChoixArticle.List(j, 3) = c.Offset(0, 4)
j = j + 1
Next c
End If
Call maj '///ajout pmo
End Sub
Private Sub ChoixArticle_Click()
ligne = Me.ChoixArticle.Column(3)
maj
End Sub
Sub maj()
'///ajout pmo
If tempoLig > 0 Then
ligne = tempoLig
tempoLig = 0
End If
'//////////////
Me.Textbox1 = f.Cells(ligne, 2)
Me.TextBox2 = f.Cells(ligne, 3)
Me.TextBox3 = f.Cells(ligne, 4)
Me.TextBox5 = f.Cells(ligne, 5)
Me.TextBox4 = f.Cells(ligne, 6)
End Sub
Private Sub Fermer_Click()
Unload Me
End Sub