ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ISNUMBER (https://www.excelbanter.com/excel-programming/292396-isnumber.html)

Brady Snow

ISNUMBER
 
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

Frank Kabel

ISNUMBER
 
Hi
try
If IsNumeric(....) then


--
Regards
Frank Kabel
Frankfurt, Germany

Brady Snow wrote:
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


Keith Willshaw

ISNUMBER
 

"Brady Snow" wrote in message
...
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



Tom Ogilvy

ISNUMBER
 
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

--
Regards,
Tom Ogilvy


"Brady Snow" wrote in message
...
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




Harlan Grove

ISNUMBER
 
"Tom Ogilvy" wrote...
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



Tom Ogilvy

ISNUMBER
 
My guess would be yes.

Good addition.

Thanks,
Tom Ogilvy

"Harlan Grove" wrote in message
...
"Tom Ogilvy" wrote...
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






All times are GMT +1. The time now is 03:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com