OVH Cloud OVH Cloud

Problème!!

8 réponses
Avatar
STEN83
Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition humaine!
Merci à tous

8 réponses

Avatar
Pounet95
Bonsoir,
Le code c'est bien, mais si il était possible d'avoir le libellé du message
d'erreur,
ce serait pas mal.
Juste en lisant en diagonale, pourquoi seul le Text200 a droit à une
conversion Cdbl ?

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de news:

Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition humaine!
Merci à tous


Avatar
Patrick Fredin
Bonjour,

J'imagine que cela vient du fait qu'il n'y a rien dans le TextBox. Il ne
peut pas additionner Rien. Donc, fais un contrôle sur le contenu du TextBox.
Si c'est égal à "", alors ajoute 0,

--
Patrick

"STEN83" wrote in message
news:
Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 ?", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " ?" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition humaine!
Merci à tous


Avatar
STEN83
Bonsoir Pounet95,
Tout d'abord merci d'avoir répondu aussi rapidement a ma question,
pour ce qu'y est du message d'erreur:

Erreur d'exécution '13'
Incomptabilité de type

Voilà merci de ton aide


Bonsoir,
Le code c'est bien, mais si il était possible d'avoir le libellé du message
d'erreur,
ce serait pas mal.
Juste en lisant en diagonale, pourquoi seul le Text200 a droit à une
conversion Cdbl ?

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de news:

Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition humaine!
Merci à tous






Avatar
PanZzaNni
J'ai travailler il n'y a pas longtemps avec des textbox et je me cassais
la tête parcequ'il n'arrivait pas à faire mon If...

Finalement, on faisant un pas-à-pas détaillé, j'ai trouvé que même si on
écrit textbox.value, la valeur renvoyée est de type string.

Pour avoir la valeur d'un textebox, il faut écrire

Val(textbox)

Si je me souviens bien

Dis nous quoi...

;)



Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide


Avatar
Pounet95
Re,
Je crois, pour compléter le message de Patrick, qu'il faut effectivement
tester
après chaque évènement Change :
- si la valeur est vide, alors forcer à 0 la valeur du Textbox
- utiliser l'évènement KeyPress du Textbox pour n'autoriser que la saisie
de chiffres

Si problème pour faire, demande ici

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de news:

Bonsoir Pounet95,
Tout d'abord merci d'avoir répondu aussi rapidement a ma question,
pour ce qu'y est du message d'erreur:

Erreur d'exécution '13'
Incomptabilité de type

Voilà merci de ton aide


Bonsoir,
Le code c'est bien, mais si il était possible d'avoir le libellé du
message
d'erreur,
ce serait pas mal.
Juste en lisant en diagonale, pourquoi seul le Text200 a droit à une
conversion Cdbl ?

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de
news:

Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition
humaine!
Merci à tous








Avatar
STEN83
Bonjour,
Peut tu me donner un exemple au sujet de la commande Keypress et pour forcer
la valeur du Textbox a 0 merci


Re,
Je crois, pour compléter le message de Patrick, qu'il faut effectivement
tester
après chaque évènement Change :
- si la valeur est vide, alors forcer à 0 la valeur du Textbox
- utiliser l'évènement KeyPress du Textbox pour n'autoriser que la saisie
de chiffres

Si problème pour faire, demande ici

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de news:

Bonsoir Pounet95,
Tout d'abord merci d'avoir répondu aussi rapidement a ma question,
pour ce qu'y est du message d'erreur:

Erreur d'exécution '13'
Incomptabilité de type

Voilà merci de ton aide


Bonsoir,
Le code c'est bien, mais si il était possible d'avoir le libellé du
message
d'erreur,
ce serait pas mal.
Juste en lisant en diagonale, pourquoi seul le Text200 a droit à une
conversion Cdbl ?

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de
news:

Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition
humaine!
Merci à tous












Avatar
Pounet95
Bonjour,
Il suffit de demander ....
Voici un exemple à adapter
J'ai laissé de quoi traiter les majuscules, minuscules , espace et tiret
A mettre dans le module du usf

Private Sub txt_Code_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 20, 45, 48 To 57, 65 To 90
'espace, tiret, A , B , C et 0 ....9 OK !
Case 97 To 122
'a , b , c .... en majuscule !
KeyAscii = KeyAscii - 32
Case Else
KeyAscii = Asc(Chr(8))
MsgBox "Caractère non autorisé !"
End Select
End Sub

' et pour forcer à 0 si vide
'
Private Sub txt_Code_Change()
If Trim(txt_Code.Text) = "" Then txt_Code.Text = "0"
End Sub

Bonne journée
--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de news:

Bonjour,
Peut tu me donner un exemple au sujet de la commande Keypress et pour
forcer
la valeur du Textbox a 0 merci


Re,
Je crois, pour compléter le message de Patrick, qu'il faut effectivement
tester
après chaque évènement Change :
- si la valeur est vide, alors forcer à 0 la valeur du Textbox
- utiliser l'évènement KeyPress du Textbox pour n'autoriser que la
saisie
de chiffres

Si problème pour faire, demande ici

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de
news:

Bonsoir Pounet95,
Tout d'abord merci d'avoir répondu aussi rapidement a ma question,
pour ce qu'y est du message d'erreur:

Erreur d'exécution '13'
Incomptabilité de type

Voilà merci de ton aide


Bonsoir,
Le code c'est bien, mais si il était possible d'avoir le libellé du
message
d'erreur,
ce serait pas mal.
Juste en lisant en diagonale, pourquoi seul le Text200 a droit à une
conversion Cdbl ?

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de
news:

Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un
des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition
humaine!
Merci à tous














Avatar
STEN83
Merci a tous vous êtes des pros!


Bonjour,
Il suffit de demander ....
Voici un exemple à adapter
J'ai laissé de quoi traiter les majuscules, minuscules , espace et tiret
A mettre dans le module du usf

Private Sub txt_Code_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 20, 45, 48 To 57, 65 To 90
'espace, tiret, A , B , C et 0 ....9 OK !
Case 97 To 122
'a , b , c .... en majuscule !
KeyAscii = KeyAscii - 32
Case Else
KeyAscii = Asc(Chr(8))
MsgBox "Caractère non autorisé !"
End Select
End Sub

' et pour forcer à 0 si vide
'
Private Sub txt_Code_Change()
If Trim(txt_Code.Text) = "" Then txt_Code.Text = "0"
End Sub

Bonne journée
--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de news:

Bonjour,
Peut tu me donner un exemple au sujet de la commande Keypress et pour
forcer
la valeur du Textbox a 0 merci


Re,
Je crois, pour compléter le message de Patrick, qu'il faut effectivement
tester
après chaque évènement Change :
- si la valeur est vide, alors forcer à 0 la valeur du Textbox
- utiliser l'évènement KeyPress du Textbox pour n'autoriser que la
saisie
de chiffres

Si problème pour faire, demande ici

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de
news:

Bonsoir Pounet95,
Tout d'abord merci d'avoir répondu aussi rapidement a ma question,
pour ce qu'y est du message d'erreur:

Erreur d'exécution '13'
Incomptabilité de type

Voilà merci de ton aide


Bonsoir,
Le code c'est bien, mais si il était possible d'avoir le libellé du
message
d'erreur,
ce serait pas mal.
Juste en lisant en diagonale, pourquoi seul le Text200 a droit à une
conversion Cdbl ?

--
Pounet95
on trouve tout ( ou presque ) http://www.excelabo.net/

"STEN83" a écrit dans le message de
news:

Bonjour, j'ai un petit problème avec des textbox
Par l'intemédiaire d'un usf j'additionne des chiffre entrés dans des
textbox, mais lorsque je veux supprimer un chiffre erroné dans l'un
des
textbox il m'affiche un message d'erreur!
Voici le code de mon usf


Private Sub CmdValid_Click()
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)
FPOSTE.Range("F14").Value = FDRDEBUT.TextTotal.Value
If TextTotal.Value = 200 Then
MsgBox "Fond de roulement à 200 €", vbInformation, "FDR Correct"
Unload Me

Else
MsgBox "Fond de roulement incorrect" & Chr(13) _
& "Il y a " & TextTotal.Value & " €" & Chr(13) _
& "Vous devriez recompter!", vbCritical, "FDR Incorrect"
End If


End Sub

Private Sub Textmulti01_Change()
Text01 = CDbl(Textmulti01) * 0.1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti02_Change()
Text02 = CDbl(Textmulti02) * 0.2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti05_Change()
Text05 = CDbl(Textmulti05) * 0.5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti1_Change()
Text1 = CDbl(Textmulti1) * 1
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti10_Change()
Text10 = CDbl(Textmulti10) * 10
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti100_Change()
Text100 = CDbl(Textmulti100) * 100
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti2_Change()
Text2 = CDbl(Textmulti2) * 2
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti20_Change()
Text20 = CDbl(Textmulti20) * 20
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti200_Change()

Text200 = CDbl(Textmulti200) * 200
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti5_Change()
Text5 = CDbl(Textmulti5) * 5
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub Textmulti50_Change()
Text50 = CDbl(Textmulti50) * 50
TextTotal = CDbl(Text200.Value) + (Text100.Value) + (Text50.Value) +
(Text20.Value) + (Text10.Value) + (Text5.Value) + (Text2.Value) +
(Text1.Value) + (Text05.Value) + (Text02.Value) + (Text01.Value)

End Sub

Private Sub UserForm_Activate()
Text200.Value = 0
Text100.Value = 0
Text50.Value = 0
Text20.Value = 0
Text10.Value = 0
Text5.Value = 0
Text2.Value = 0
Text1.Value = 0
Text05.Value = 0
Text02.Value = 0
Text01.Value = 0

End Sub
Merci de votre aide
--
Le partage du savoir contribue à l'amélioration de la condition
humaine!
Merci à tous