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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
Dim f
Private Sub Com_bout_validez_Click()
' empecher de validez si tous n'est pas remplie
If Text_quantité = "" Or Combo_service = "" Or Text_ref = "" Or Combo_equipement = "" Or Text_designation = "" Or Text_fournisseur = "" Or Text_bac = "" Or Text_prix = "" Or Text_min = "" Or Text_max = "" Then
MsgBox ("Merci de remplir tous les chanps")
Exit Sub
End If
' selectionne la derniere ligna du stock
Sheets("Stock").Activate
Range("A65536").End(xlUp).Offset(1, 0).Select
' Copie des informations dans la base
ActiveCell.Offset(0, 0) = Combo_service
ActiveCell.Offset(0, 1) = Combo_equipement
ActiveCell.Offset(0, 2) = Text_designation
ActiveCell.Offset(0, 3) = Text_fournisseur
ActiveCell.Offset(0, 4) = Text_ref
ActiveCell.Offset(0, 5) = Text_prix
ActiveCell.Offset(0, 6) = Text_quantité
ActiveCell.Offset(0, 7) = Text_min
ActiveCell.Offset(0, 8) = Text_max
ActiveCell.Offset(0, 9) = Text_bac
' effacement des celulles de use form
Combo_service = ""
Combo_equipement = ""
Text_designation = ""
Text_fournisseur = ""
Text_ref = ""
Text_prix = ""
Text_quantité = ""
Text_min = ""
Text_max = ""
Text_bac = ""
Form_Entre_pieces.Hide
Sheets("Menu").Activate
End Sub
Private Sub Combo_service_Change()
Me.Combo_equipement.Clear
i = 0
For Each C In f.Range("A1:A" & f.[A65000].End(xlUp).Row)
If C.Value = Me.Combo_service Then
Me.Combo_equipement.AddItem C.Offset(, 1).Value
Me.Combo_equipement.List(i, 1) = C.Offset(, 1).Value
i = i + 1
End If
Next C
End Sub
Private Sub UserForm_Initialize()
Set f = Sheets("Liste")
Set dico = CreateObject("Scripting.Dictionary")
Dim A()
i = 0
For Each C In f.Range("A1:A" & f.[A65000].End(xlUp).Row)
If Not dico.exists(C.Value) Then
Me.Combo_service.AddItem C.Value
Me.Combo_service.List(i, 1) = C.Offset(, 1).Value
i = i + 1
dico(C.Value) = ""
End If
Next C
End Sub |
Partager