ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Numbers (https://www.excelbanter.com/excel-programming/303957-numbers.html)

Jevul

Numbers
 
Hello,

I am trying to figure out a way to prevent users from
entering a "not real" number into a text box. I tried to
ues an If statement.... If Not Isnumeric......
This doesn't seem to work. I had a user input "2345.45-"
with no error but excel igneroed the number in a
calculation. My users are bound to make many mistakes
and I would like to catch them at the time.

Thanks

Bob Flanagan

Numbers
 
Try using Application.IsNumber()

Even better is to set a cell to the text box value and then test the value
of the cell to see if the above is true. Why? Try 100%. If in a text box,
it is not a number. But if written to a cell, it is a number.

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Jevul" wrote in message
...
Hello,

I am trying to figure out a way to prevent users from
entering a "not real" number into a text box. I tried to
ues an If statement.... If Not Isnumeric......
This doesn't seem to work. I had a user input "2345.45-"
with no error but excel igneroed the number in a
calculation. My users are bound to make many mistakes
and I would like to catch them at the time.

Thanks




Doug Glancy

Numbers
 
Bob,

Another great tip from this ng. I knew about Application.IsNumber, but your
point about setting it to a cell is new to me. Now, if I can just find a
corner of my brain to stuff it in...

Thanks,

Doug Glancy

"Bob Flanagan" wrote in message
...
Try using Application.IsNumber()

Even better is to set a cell to the text box value and then test the value
of the cell to see if the above is true. Why? Try 100%. If in a text

box,
it is not a number. But if written to a cell, it is a number.

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Jevul" wrote in message
...
Hello,

I am trying to figure out a way to prevent users from
entering a "not real" number into a text box. I tried to
ues an If statement.... If Not Isnumeric......
This doesn't seem to work. I had a user input "2345.45-"
with no error but excel igneroed the number in a
calculation. My users are bound to make many mistakes
and I would like to catch them at the time.

Thanks






Jevul

Numbers
 
Thanks, works perfectly!
-----Original Message-----
Try using Application.IsNumber()

Even better is to set a cell to the text box value and

then test the value
of the cell to see if the above is true. Why? Try

100%. If in a text box,
it is not a number. But if written to a cell, it is a

number.

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros

for Excel

"Jevul" wrote in

message
...
Hello,

I am trying to figure out a way to prevent users from
entering a "not real" number into a text box. I tried

to
ues an If statement.... If Not Isnumeric......
This doesn't seem to work. I had a user

input "2345.45-"
with no error but excel igneroed the number in a
calculation. My users are bound to make many mistakes
and I would like to catch them at the time.

Thanks



.



All times are GMT +1. The time now is 10:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com