Enter this sub in your form:

Private Sub TextBox1_Change()

If Asc(Mid(TextBox1.Text, Len(TextBox1.Text), 1)) < Asc("0") Or
Asc(Mid(TextBox1.Text, Len(TextBox1.Text), 1)) > Asc("9") Then
TextBox1.Text = Mid(TextBox1.Text, 1, Len(TextBox1.Text) - 1)
Beep
End If
End Sub

If you want to also accept decimals, exp10, and negative numbers then change
the condition to something like IsNumber()...

--
Stefano Gatto


"KingG" wrote:

>
> Hi all,
>
> how can I in VBA to set the Content of a Textbox to accept only e.g.
> Numbers and Not letters?
>
> Thank you in advance
>
>
> --
> KingG
> ------------------------------------------------------------------------
> KingG's Profile: http://www.excelforum.com/member.php...o&userid=34375
> View this thread: http://www.excelforum.com/showthread...hreadid=541539
>
>