View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tim Zych Tim Zych is offline
external usenet poster
 
Posts: 389
Default finding only numeric values in a worksheet using vb.net?

Good points Rick..interesting walkthrough.

It seems safer to use Excel's IsNumber function
(Excel.WorksheetFunction.IsNumber) or even SpecialCells than IsNumeric. I
haven't played around with IsNumber it enough to know if it let's
non-numeric characters "pass the test" like IsNumeric does, but it certainly
seems to evaluate better what it's function name suggests. Perhaps
"IsNumeric" should be renamed "CanBeNumeric".

--
Tim Zych
SF, CA

"Rick Rothstein (MVP - VB)" wrote in
message ...
If Len(c.Value) = 10 And IsNumeric(c.Value) = True Then


The above statement is from your posted code. The IsNumeric function is
not one of the best ways to "proof" an entry for being all digits (or even
a floating point value for that matter). For example, put "$(2,,e12)$"
(without the quote marks) in one of the cells being tested by your code
and the logical statement for the If function will return True when it
gets to that cell. I would perform the test this way...