Bonjour
Faire une comparaison de 2 textbox par rapport à 2 tolérances avec affichage d'un label
pour le moment
je fais la comparaison sur la textbox1 avec la tolérance 1 et affiche le label conforme ou non-conforme
je fais la comparaison sur la textbox2 avec la tolérance 2 et affiche le label conforme2 ou non-conforme2
Voici le code
Ce que je cherche a faire
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Private Sub UserForm_Initialize() Dim tol1, tol2 As Single tol1 = 95 tol2 = 120 txt1.Value = tol1 txt2.Value = tol2 labYes.Visible = False LabNo.Visible = False labYes2.Visible = False labNo2.Visible = False End Sub Private Sub txt3_AfterUpdate() If txt3.Value = "" Then labYes.Visible = False LabNo.Visible = False Exit Sub End If Dim tol1 As Single Dim val1 As Single tol1 = UserForm1.txt1.Value val1 = UserForm1.txt3.Value If val1 < tol1 Then LabNo.Visible = True labYes.Visible = False ElseIf val1 >= tol1 Then labYes.Visible = True LabNo.Visible = False End If End Sub Private Sub txt4_AfterUpdate() If txt4.Value = "" Then labYes2.Visible = False labNo2.Visible = False Exit Sub End If Dim tol2 As Single Dim val2 As Single tol2 = UserForm1.txt2.Value val2 = UserForm1.txt4.Value If val2 < tol2 Then labNo2.Visible = True labYes2.Visible = False ElseIf val2 >= tol2 Then labYes2.Visible = True labNo2.Visible = False End If End Sub
afficher le label "non conforme" ou " conforme" qu'une seule fois c'est a dire (comme la formule SI OU)
Si textbox1 et textbox2 sont supérieur ou égale alors on affiche le label "conforme"
Si textbox1 ou textbox2 sont conforme alors on affiche le label "non-conforme"
si textbox1 et textbox2 sont non-conforme alors on affiche le label "non-conforme"
et ne plus avoir besoin des label conforme2 et non-conforme2
Voili voilou
merci pour vos retour
Partager