Bonjour,
A mettre dans le module de la Form. Les bornes à adapter sont dans la proc "Exit". Pour mon exemple, le TextBox s'appelle "TextBox1" :
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.Text = "" Then Exit Sub
'changer les bornes ici !
If CDbl(TextBox1.Text) < 10 Or CDbl(TextBox1.Text) > 25.5 Then
MsgBox "La valeur doit être comprise entre 10 et 25.5 !"
TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Text)
Cancel = True
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 44, 46 'séparateur décimal
KeyAscii = Asc(Format(0, "."))
Case 48 To 57
'ne rien faire, touches 0 à 9
Case Else 'seulement numérique
KeyAscii = 0
End Select
End Sub