Option Explicit
Private Sub CB_Choix_Client_Click() 'ComboBox alimenté par une plage dynamique
If Not CB_Choix_Client.Text = "" Then Range("CodeClient") = CB_Choix_Client.Text
TB_Ref_Client.SetFocus
End Sub
Private Sub CB_Choix_Soupape_Click() 'ComboBox alimenté par une plage dynamique
If Not CB_Choix_Soupape.Text = "" Then Range("ChoixSoupape") = CB_Choix_Soupape.Text
CB_Choix_Client.SetFocus
End Sub
Private Sub CB_Technicien_Click() 'ComboBox alimenté par une plage
Range("Technicien") = CB_Technicien.Text
End Sub
Private Sub CMB_Edition_Click() 'CommandButton
Call Edition_Certificat
End Sub
Private Sub TB_Num_Soupape_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
If Not TB_Num_Soupape.Text = "" Then
If Range("Fin_Numeros").End(xlUp).Row < Range("Fin_Numeros").Row - 1 Then
Application.EnableEvents = False
Range("C" & Range("Fin_Numeros").End(xlUp).Row).Offset(1, 0) = TB_Num_Soupape.Text
Else
MsgBox "5 numéros seulement"
End If
TB_Num_Soupape.Text = ""
End If
End If
Application.EnableEvents = True
End Sub
Private Sub TB_Ref_BCF_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
If Not TB_Ref_BCF.Text = "" Then
If (Len(TB_Ref_BCF.Text) <> 6 And Len(TB_Ref_BCF.Text) <> 5) Or Not IsNumeric(TB_Ref_BCF.Text) Then
MsgBox "Mauvais code affaire"
With Soupapes.TB_Ref_BCF
.Text = ""
.SetFocus
End With
Exit Sub
End If
Application.EnableEvents = False
Range("Cde_BCF") = TB_Ref_BCF.Text
Application.EnableEvents = True
End If
End If
End Sub
Private Sub TB_Ref_Client_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then If Not TB_Ref_Client.Text = "" Then Range("CdeClient") = TB_Ref_Client.Text
End Sub
Private Sub UserForm_Initialize()
Dim Controle As Control
For Each Controle In Me.Controls
Select Case TypeName(Controle)
Case "ComboBox", "TextBox"
Controle.Text = ""
Case Else
End Select
Next
End Sub