Private Sub TbxValeurLibre_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 44 If InStr(TbxValeurLibre.Text, ",") Then KeyAscii = 0 Case 48 To 57 Case Else KeyAscii = 0 End Select End Sub
Private Sub TbxValeurLibre_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 44 If InStr(TbxValeurLibre.Text, ",") Then KeyAscii = 0 Case 48 To 57 Case Else KeyAscii = 127 End Select End Sub
Sub TbxValeurLibre_KeyPress(ByVal KeyAscii As USForms.ReturnInteger)
Select Case KeyAscii
case 8
Case 44
If InStr(TbxValeurLibre.Text, ",") Then KeyAscii = 0
Case 48 To 57
Case Else : KeyAscii = 0
End Select
End Sub
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionCase 8, 48 To 57
If KeyAscii <>8 and KeyAscii < 44 and KeyAscii > 57 Then KeyAscii = 127 End If If KeyAscii 44 or KeyAscii 8 then If InStr(TbxValeurLibre.Text, ",") Then KeyAscii = 0 end if
Private Sub TextBox1_Change() Static anc As String If Not IsNumeric(TextBox1.Text) Or UCase(TextBox1) Like "*[A-Z]*" Then TextBox1.Text = anc: beep Else anc = TextBox1 End If End Sub
Dim d As Double Try d = CDbl(TextBox1.Text) Catch ex As Exception MsgBox("Saisie unvalide") TextBox1.Focus() End Try