Private Sub ok_bouton_Click()
Application.ScreenUpdating = False
'Déclaration de 2 variables
Dim i As Long
Dim couleur, ean As Variant
couleur = Application.VLookup(Me.nb_ref.Value, Sheets("TEMPLATE_FAC").Range("A1:G27"), 6, False)
ean = Application.VLookup(Me.nb_ref.Value, Sheets("TEMPLATE_FAC").Range("A1:G27"), 3, False)
With Selection
If nb_ref.Value <> "" Then
If CSng(uc_restant.Caption) < CSng(nb_uc.Value) Then
MsgBox "Vous n'avez pas la capacité de mettre tant d'UC / lots !", vbInformation, "Information"
End
End If
For i = 2 To 27
If Sheets("TEMPLATE_FAC").Range("A" & i).Value = nb_ref.Value Then
Sheets("TEMPLATE_FAC").Range("G" & i).Value = Sheets("TEMPLATE_FAC").Range("G" & i).Value - nb_uc.Value
End If
Next i
.Merge
.Interior.ColorIndex = couleur
.Value = nb_ref & " " & nb_uc & " " & ean
'----------- CODE A VOIR -----------------
Dim chiffre As Integer
Dim lettre As String
chiffre = Mid(ActiveCell.Value, 3, 2)
lettre = Mid(ActiveCell.Value, 1, 1)
MsgBox lettre & " " & chiffre
End
End If
'-----------------------------------------
If confinement.Value = True Then
With .Borders
.Weight = xlMedium
.ColorIndex = 3
End With
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
End If
If calagepapier.Value = True Then
If Me.couleur.Value = "VERTE" Then 'Mise en forme cale verte
.Merge
.Interior.ColorIndex = 16
.Value = "CALE PAPIER" & " " & "(x" & qté_papier.Value & ")"
.Font.ColorIndex = 4
ElseIf Me.couleur.Value = "BLEUE" Then 'Mise en forme cale bleue
.Merge
.Interior.ColorIndex = 16
.Value = "CALE PAPIER" & " " & "(x" & qté_papier.Value & ")"
.Font.ColorIndex = 33
ElseIf Me.couleur.Value = "ROUGE" Then 'Mise en forme cale rouge
.Merge
.Interior.ColorIndex = 16
.Value = "CALE PAPIER" & " " & "(x" & qté_papier.Value & ")"
.Font.ColorIndex = 3
ElseIf Me.couleur.Value = "JAUNE" Then 'Mise en forme cale jaune
.Merge
.Interior.ColorIndex = 16
.Value = "CALE PAPIER" & " " & "(x" & qté_papier.Value & ")"
.Font.ColorIndex = 27
ElseIf Me.couleur.Value = "BLANCHE" Then 'Mise en forme cale blanche
.Merge
.Interior.ColorIndex = 16
.Value = "CALE PAPIER" & " " & "(x" & qté_papier.Value & ")"
.Font.ColorIndex = 2
End If
End If
If calagecaisse.Value = True Then
.Merge
.Interior.ColorIndex = 16
.Value = quoi_caisse & " " & "(x" & qté_caisse & ")"
.Font.ColorIndex = 1
End If
End With
End
Application.ScreenUpdating = True
End Sub