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
| Private Sub SpinButton1_Change()
Static SaveI As Long
Dim Increment As Boolean
'Bouton de défilement (Voir UserForm précédent pour détails)
'Bouton de défilement (Voir UserForm précédent pour détails)
If SpinButton1.Value > SaveI Then Increment = True
SaveI = SpinButton1.Value
i = SpinButton1.Value
If i < 2 Then
i = 2
SpinButton1.Value = i
End If
If i > 1 Then
RefProd = Feuil1.Cells(i, 1)
TextBox_Repère = Feuil1.Cells(i, 2)
TextBox_Référence = Feuil1.Cells(i, 3)
TextBox_Description = Feuil1.Cells(i, 4)
TextBox_Quantité_Stockage = Feuil1.Cells(i, 5)
ComboBox_Emplacement = Feuil1.Cells(i, 6)
TextBox_Quantité_Mini = Feuil1.Cells(i, 7)
TextBox_Commander = Feuil1.Cells(i, 8)
TextBox_Prix_Achat = Feuil1.Cells(i, 10)
RefFrn = Feuil1.Cells(i, 9)
TextBox_Délai = Feuil1.Cells(i, 11)
ComboBox_Machine = Feuil1.Cells(i, 12)
If Feuil1.Cells(i, 5) >= Feuil1.Cells(i, 7) Then
If Increment = True Then
i = i + 1
Else
i = i - 1
End If
SpinButton1.Value = i
Exit Sub
End If
For Each Ctrl In F_Type.Controls
If Feuil1.Cells(i, 13) = Ctrl.Object.Caption Then
Ctrl.Object.Value = True
Exit For
End If
Next Ctrl
End If
If RefProd = 0 Then
TextBox_Repère = ""
TextBox_Référence = ""
TextBox_Description = ""
TextBox_Quantité_Stockage = ""
ComboBox_Emplacement = ""
TextBox_Quantité_Mini = ""
TextBox_Commander = ""
TextBox_Prix_Achat = ""
TextBox_Nom_Fournisseur = ""
TextBox_Numéro_Fournisseur = ""
RefFrn = 0
TextBox_Délai = ""
ComboBox_Machine = ""
If Feuil1.Cells(i, 7) > Feuil1.Cells(i, 5) Then
If Increment = True Then
i = i + 1
Else
i = i - 1
End If
SpinButton1.Value = i
Exit Sub
End If
For Each Ctrl In F_Type.Controls
Ctrl.Object.Value = False
Next Ctrl
TextBox_Quantité_Stockage.Font.Bold = False
TextBox_Quantité_Stockage.BackColor = &H8000000F
Exit Sub
End If
'Affiche si stock égale zéro
If TextBox_Quantité_Stockage = 0 Then
TextBox_Quantité_Stockage.Font.Bold = True
TextBox_Quantité_Stockage.BackColor = vbRed
Else
TextBox_Quantité_Stockage.Font.Bold = False
TextBox_Quantité_Stockage.BackColor = &H8000000F
End If
'Affiche le nom du fournisseur
j = 2
While Feuil6.Cells(j, 1) <> ""
If Feuil6.Cells(j, 1) = RefFrn Then
TextBox_Nom_Fournisseur = Feuil6.Cells(j, 2)
End If
j = j + 1
Wend
Button_Valider.Visible = False
Button_Créer.Visible = True
End Sub |