Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restrict user entry to numeric values only
I have Active X control textboxes embeded in a spreadsheet. I created an if
then statement to check if the value is numeric. If the value is numeric then I use it in a calculation if not the user is prompted by a text box telling them to only enter numeric values. However, I can not figure out how to write a condition that "checks" if the value includes alphabetic characters. This is what I have so far Dim Prompt As String If txtQPAuto.Value is <condition?? then txtQPAuto.Value = Application.WorksheetFunction.Round(txtQPAuto.Valu e, 0) txtTQP.Value = txtQPAuto.Value + txtQPWC.Value + txtQPGL.Value + txtQPProp.Value + txtQPUmb.Value Else: Prompt = MsgBox("Please enter a whole number value.", vbOKOnly, "Total Quoted Premium") End If |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Restrict user entry to numeric values only
This one is so obvious as to not be obvious.
if isnumeric(txtQPAuto.Value) then isnumeric returns true or false depending on whether the contents are numeric or not... -- HTH... Jim Thomlinson "Nicole D." wrote: I have Active X control textboxes embeded in a spreadsheet. I created an if then statement to check if the value is numeric. If the value is numeric then I use it in a calculation if not the user is prompted by a text box telling them to only enter numeric values. However, I can not figure out how to write a condition that "checks" if the value includes alphabetic characters. This is what I have so far Dim Prompt As String If txtQPAuto.Value is <condition?? then txtQPAuto.Value = Application.WorksheetFunction.Round(txtQPAuto.Valu e, 0) txtTQP.Value = txtQPAuto.Value + txtQPWC.Value + txtQPGL.Value + txtQPProp.Value + txtQPUmb.Value Else: Prompt = MsgBox("Please enter a whole number value.", vbOKOnly, "Total Quoted Premium") End If |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Ideas on how to restrict a entry | Excel Discussion (Misc queries) | |||
Combo Box that allows user entry of values not on drop-down list | Excel Discussion (Misc queries) | |||
How do I restrict entry into a cell to only alpha/numeric? | Excel Worksheet Functions | |||
Restrict entry types | Excel Discussion (Misc queries) | |||
restrict entry in a textbox to a range of values | Excel Programming |