Option Explicit
Dim RefArt
Dim DerligRef As Integer
Dim QteArt
Dim DerLigQte As Integer
Private Sub UserForm_Initialize()
TextBox2.Visible = False
Label13.Visible = False
CommandButton8.Visible = False
TextBox1.SetFocus
End Sub
Private Sub ValiderCodeBarre()
RefArt = TextBox1.Value
With Sheets("RECEPTION PRESSE")
DerligRef = .Range("A65536").End(xlUp).Row + 1
.Cells(DerligRef, 1) = RefArt
End With
Label11.Visible = False
Label13.Visible = True
TextBox1.Visible = False
TextBox2 = ""
TextBox2.Visible = True
TextBox2.SetFocus
CommandButton7.Visible = False
CommandButton8.Visible = True
End Sub
Private Sub CommandButton8_Click()
QteArt = TextBox2.Value
With Sheets("RECEPTION PRESSE")
DerLigQte = .Range("B65536").End(xlUp).Row + 1
Cells(DerLigQte, 2) = QteArt
End With
TextBox1 = ""
TextBox1.Visible = True
Label11.Visible = True
Label13.Visible = False
TextBox2.Visible = False
CommandButton8.Visible = False
CommandButton7.Visible = True
TextBox1.SetFocus
End Sub
Private Sub TextBox1_[COLOR=red]KeyDown[/COLOR](ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
KeyCode = 0 'Annuler la touche
'voir S'il faut conserver la ligne suivante
Application.Wait (Time + TimeSerial(0, 0, 1))
ValiderCodeBarre
End If
End Sub