View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Avoid Type Mismatch Error when using CDBL()

You could try:

if isnumeric(var1) then

But be aware that VBA's isnumeric is very forgiving. If the string looks like
it could be interpreted as a number, then you'll see True.

"9E3"
(9*10*10*10 in scientific notation)






ExcelMonkey wrote:

Hi I am testing for whether or not a string variable is a number or not.
When I try:

IsNumeric(CDbl(var1))

It fails giving a Type Mismatch error when the variable is actually not a
number. I would like this to return a True/False. How do I do this?

Thanks

EM


--

Dave Peterson