What do you want really? To have the string "Record Not Found" "converted" to integer? With the value -1 or, perhaps, 666?
You explicitly assigned this value to a string in first line, why? you never use it.
First of all, if you want to store integer in some cell, store integer, not a string. Use the cell type derived from
and not anything else. If you need to edit this value in place, use
In all cases, before type-casting the cell
, check the value type:
And, finally, if you have a string which you need to parse as integer but nut sure it is always successful (as in the case with
, see above), don't use VB-specific
, use civilized and explicitly named
(will throw exception if parsing is not successful) or
; see also the parsing method with the same names for all other numeric types.