I am trying to write my own Function to check if whatever I have is a number.
This is what I have:
It is supposed to be a replacement for IsNumeric since it allows expressions such as 2e3 or 4d3 to be evaluated as True, but - in my world - it should be False.
Should I just make it simple and after IsNumeric returns True, just check for the 2 letters (E and D) and be done with it? Would it be then 'full-proof'?
---- Andy
There is a great need for a sarcasm font.
This is what I have:
Code:
Public Function IsNumber(ByRef Value As Variant) As Boolean
Dim bln As Boolean
Dim X As Integer
bln = True
If Len(Trim(Value)) = 0 Then
bln = False
Else
If IsNumeric(Value) Then
For X = 1 To Len(Value)
If (Mid(Value, X, 1) < 0 Or Mid(Value, X, 1) > 9) _
And Mid(Value, X, 1) <> "." Then
bln = False
Exit For
End If
Next X
Else
bln = False
End If
End If
IsNumber = bln
End Function
It is supposed to be a replacement for IsNumeric since it allows expressions such as 2e3 or 4d3 to be evaluated as True, but - in my world - it should be False.
Should I just make it simple and after IsNumeric returns True, just check for the 2 letters (E and D) and be done with it? Would it be then 'full-proof'?
---- Andy
There is a great need for a sarcasm font.