ISNUMBER

  • Thread starter Thread starter Brady Snow
  • Start date Start date
B

Brady Snow

I am trying to test whether the active cell is numeric or
not. I use the following code and it tells me that
IsNumber is not a valid sub or function. Can somebody
tell me what I am doing wrong?

If IsNumber(ActiveCell.Offset(0, Y - 1).Value) Then
MsgBox ("True")
End If

Thank you,

Brady Snow
McKinney, Texas
 
Brady Snow said:
I am trying to test whether the active cell is numeric or
not. I use the following code and it tells me that
IsNumber is not a valid sub or function. Can somebody
tell me what I am doing wrong?

If IsNumber(ActiveCell.Offset(0, Y - 1).Value) Then
MsgBox ("True")
End If

Thank you,

Try IsNumeric instead of IsNumber

Keith
 
If you want to know if it can be interpreted as a number, use IsNumeric

If IsNumeric(ActiveCell.Offset(0, Y - 1).Value) Then

if you want to know if excel is storing it as a number

If Application.IsNumber(ActiveCell.Offset(0, Y - 1).Value) Then
 
Tom Ogilvy said:
if you want to know if excel is storing it as a number

If Application.IsNumber(ActiveCell.Offset(0, Y - 1).Value) Then
....

I wonder if VarType would be faster?

If VarType(ActiveCell.Offset(0, Y - 1).Value2) = 5 Then
 
Back
Top