Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default TextBox that only accepts integers?

What would be the best way to check that text is a positive whole
number? I'm thinking about putting it in the textbox_exit event.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default TextBox that only accepts integers?

Hi

Exit is too late. Use the Keypress event. Set keyascii to 0 if its < 48 or
57.


Except (tricky part coming up): Keydown event to trap and validate Ctrl V.

HTH. Best wishes Harald

"Claud Balls" skrev i melding
...
What would be the best way to check that text is a positive whole
number? I'm thinking about putting it in the textbox_exit event.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default TextBox that only accepts integers?

You can validate the contents of the textbox using the isnumeric function.
You will also have to look for "-" and "." using the instr function.


"Claud Balls" wrote:

What would be the best way to check that text is a positive whole
number? I'm thinking about putting it in the textbox_exit event.



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

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
Function that accepts and returns a decimal, is it possible? LongBow Excel Worksheet Functions 0 August 30th 07 10:17 AM
How to auto-return to next cell that accepts data. [email protected] Excel Worksheet Functions 4 April 21st 07 03:44 AM
A list of Consecutive Integers, can I search for missing integers CM Excel Worksheet Functions 4 September 2nd 05 06:38 PM
Sheet Name not accepts special characters Bhuktar S[_4_] Excel Programming 1 April 23rd 04 11:46 AM
Forcing Integers into Textbox Nigel[_8_] Excel Programming 4 January 12th 04 12:28 AM


All times are GMT +1. The time now is 02:19 PM.

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"