VBA: IsNumeric Function Returning True Even If Data Contains Letters. Any Other Way To Validate Entry?

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
I am using an inputbox to assign value(s) to my variable. After that I use the IsNumeric Function to check if the entry is a valid number.

During the testing process, I realized that I mistakenly entered 4e4 and instead of the function flagging that out as an invalid number, it went through as a number.

I have tried replacing the e with other letters and they were caught by the function yet the e always goes through when it comes between two numbers.

Is there a better way to validate my input?

Thanks in advance.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
I think we are at cross purposes here. I was replying to your question about the Instr method posted by bebbo being case sensitive.
Yes it is the same post I was referring to.

When I entered 4e4 and 4E4, they both got flagged as invalid numbers.

Bebbo's code. And the code did handle decimals and commas, but just like with the case of your version with the comma, inputs like 2,3 were accepted - which I don't want to accept as valid numbers.
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,784
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top