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
| Private Sub TextBox_Lot_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox_Lot.Value = "" Then
X = MsgBox("Le format du numéro de lot saisi n'est pas valide", vbExclamation)
Cancel = True
End If
Me.MultiPage1.Enabled = True
With ThisWorkbook.Worksheets("Test")
.Range("B3:B200").NumberFormat = "0"
If .AutoFilterMode = True Then .AutoFilterMode = False
Set C = .Range("B3:B200").Find(TextBox_Lot.Value, LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
'____________________________________
' Si le lot est déjà dans la liste
If Not C Is Nothing Then
n = C.Row
TextBox_Lot.ForeColor = &HC000&
'____________________________________
' Affichage des données stérilité
If .Cells(n, 14).Value <> "" And .Cells(n, 15).Value <> "" Then
TextBox_JF_Ste.Value = Left(.Cells(n, 14).Value, 5)
TextBox_HF_Ste.Value = FormatDateTime(TimeValue(.Cells(n, 14)), vbShortTime)
ComboBox_Visa_Ste.Value = .Cells(n, 15).Value
End If
TextBox_Comment_Ste.Value = .Cells(n, 16).Value
'____________________________________
' Affichage des données activité
If .Cells(n, 21).Value <> "" And .Cells(n, 22).Value <> "" Then
TextBox_JF_Act.Value = Left(.Cells(n, 21).Value, 5)
TextBox_HF_Act.Value = FormatDateTime(TimeValue(.Cells(n, 21)), vbShortTime)
ComboBox_Visa_Act.Value = .Cells(n, 22).Value
End If
TextBox_Comment_Act.Value = .Cells(n, 23).Value
'____________________________________
' Affichage des données acceptation
If .Cells(n, 24).Value <> "" And .Cells(n, 25).Value <> "" And .Cells(n, 26).Value <> "" Then
If .Cells(n, 24).Value = "O" Then CheckBox_Doss_C.Value = True
If .Cells(n, 24).Value = "N" Then CheckBox_Doss_NC.Value = True
TextBox_JF_Acc.Value = Left(.Cells(n, 25).Value, 5)
TextBox_HF_Acc.Value = FormatDateTime(TimeValue(.Cells(n, 25)), vbShortTime)
ComboBox_Visa_Acc.Value = .Cells(n, 26).Value
End If
TextBox_Comment_Acc.Value = .Cells(n, 27).Value
'____________________________________
' blocage des champs si pas activité/stérilité
If .Cells(n, 10).Value = "N" Then Me.MultiPage1.page2.Enabled = False
If .Cells(n, 17).Value = "N" Then Me.MultiPage1.page1.Enabled = False
End If 'end if si lot déjà dans la liste
fin:
End With
End Sub |
Partager