[VBA]Textbox de Userform Contrôlé
Résolu/Fermé
lml-mike
Messages postés
455
Date d'inscription
vendredi 16 février 2007
Statut
Contributeur
Dernière intervention
18 novembre 2018
-
7 sept. 2010 à 11:48
lml-mike Messages postés 455 Date d'inscription vendredi 16 février 2007 Statut Contributeur Dernière intervention 18 novembre 2018 - 7 sept. 2010 à 12:09
lml-mike Messages postés 455 Date d'inscription vendredi 16 février 2007 Statut Contributeur Dernière intervention 18 novembre 2018 - 7 sept. 2010 à 12:09
A voir également:
- [VBA]Textbox de Userform Contrôlé
- Controle parental pc - Guide
- Excel compter cellule couleur sans vba - Guide
- Controle de compte utilisateur - Guide
- Vba attendre 1 seconde ✓ - Forum VB / VBA
- Controle parental disney plus - Guide
1 réponse
lml-mike
Messages postés
455
Date d'inscription
vendredi 16 février 2007
Statut
Contributeur
Dernière intervention
18 novembre 2018
121
7 sept. 2010 à 12:09
7 sept. 2010 à 12:09
Bon ben problème réglé lol !
Il faut simplement mettre une condition si la valeur est négative pour mettre la valeur maximale à la place sur la condition change ^^'
Il faut simplement mettre une condition si la valeur est négative pour mettre la valeur maximale à la place sur la condition change ^^'
Private Sub UserForm_Initialize() text3.Value = text1.Value text2.Value = 0 End Sub Public Sub Text2_change() Dim Prix As Single Dim prixtot As Single If text2.Value = "" Then Exit Sub Else text3.Value = text1.Value - text2.Value If text3.Value < 0 Then text3.Value = 0 text2.Value = text1.Value End If End If End Sub Private Sub Text2_Enter() text2.Value = "" End Sub Public Sub Text2_keypress(ByVal Keyascii As MSForms.ReturnInteger) If InStr("1234567890.", Chr(Keyascii)) = 0 _ Or InStr(text1.Value, ".") <> 0 And Chr(Keyascii) = "." Then Keyascii = 0: Beep End If End Sub Public Sub Text3_change() Dim Prix As Single Dim prixtot As Single If text3.Value = "" Then Exit Sub Else text2.Value = text1.Value - text3.Value If text2.Value < 0 Then text2.Value = 0 text3.Value = text1.Value End If End If End Sub Private Sub Text3_Enter() text3.Value = "" End Sub Public Sub Text3_keypress(ByVal Keyascii As MSForms.ReturnInteger) If InStr("1234567890.", Chr(Keyascii)) = 0 _ Or InStr(text1.Value, ".") <> 0 And Chr(Keyascii) = "." Then Keyascii = 0: Beep End If End Sub