Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
textbox
Is there an easy way of only allowing numbers and one
decimal point to be entered in a textbox? I've found a rather long winded way of solving the number bit (see code below) but checking each previously entered character to see if its a decimal point has proved to be a problem; and there must be a simpler way! Private Sub TextBox1_Change() If TextBox1.Text < "" Then If Asc(Right(TextBox1.Text, 1)) < 48 _ Or Asc(Right(TextBox1.Text, 1)) 57 Then TextBox1.Text = _ Left(TextBox1.Text, TextBox1.TextLength - 1) End If End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate Textbox value based on another textbox value.doc | Excel Discussion (Misc queries) | |||
Calculate Textbox value based on another textbox value | Excel Discussion (Misc queries) | |||
Textbox | Excel Programming | |||
to textbox | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |