Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ideas on how to restrict a entry Alexandra Excel Discussion (Misc queries) 6 May 28th 09 11:16 PM
Combo Box that allows user entry of values not on drop-down list donnadelayed Excel Discussion (Misc queries) 1 July 2nd 08 04:20 PM
How do I restrict entry into a cell to only alpha/numeric? SusanMurray Excel Worksheet Functions 3 May 5th 06 03:23 PM
Restrict entry types Dolalu Excel Discussion (Misc queries) 1 November 29th 05 06:24 PM
restrict entry in a textbox to a range of values Dillonstar[_3_] Excel Programming 5 October 30th 03 05:00 PM


All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"