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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| Private Sub ListBox2_Click() 'Lors de la sélection d'un fournisseur, afficher les produits
ListBox1.Clear
For Each f In[Liste].Offset(0, 8)
If f.Value = ListBox2.Text Then ListBox1.AddItem f.Offset(0, -8)
Next f
End Sub
Private Sub ListBox4_Click()
ListBox1.Clear
For Each f In[Liste].Offset(0, 1)
If f.Value = ListBox4.Text Then ListBox1.AddItem f.Offset(0, -1)
Next f
End Sub
Private Sub RefEdit1_BeforeDragOver(Cancel As Boolean, ByVal Data As MSForms.DataObject, ByVal x As stdole.OLE_XPOS_CONTAINER, ByVal y As stdole.OLE_YPOS_CONTAINER, ByVal DragState As MSForms.fmDragState, Effect As MSForms.fmDropEffect, ByVal Shift As Integer)
End Sub
Private Sub UserForm_Initialize()
Me.ListBox1.List =[Liste].Value
'*** Lister les fournisseurs sans doublons
Set listef = CreateObject("scripting.dictionary")
For Each c In[Liste].Offset(0, 8)
If Not listef.exists(c.Value) Then listef(c.Value) = c.Value
Next c
ListBox2.List = listef.keys
Set listef = CreateObject("scripting.dictionary")
For Each c In[Liste].Offset(0, 1)
If Not listef.exists(c.Value) Then listef(c.Value) = c.Value
Next c
ListBox4.List = listef.keys
'***
End Sub
Private Sub TextBox1_Change()
Me.ListBox1.Clear
For Each c In[Liste]
If UCase(c) Like UCase(Me.TextBox1) & "*" Then Me.ListBox1.AddItem c
Next c
End Sub
Private Sub TextBox2_Change()
Me.ListBox1.Clear
For Each c In[Liste]
If UCase(c) Like "*" & UCase(Me.TextBox2) & "*" Then Me.ListBox1.AddItem c
Next c
End Sub
Private Sub ListBox1_Click()
ActiveCell = Me.ListBox1
Unload Me
End Sub |
Partager