# Thread: [RESOLVED] IsNumeric in Excel

1. ## [RESOLVED] IsNumeric in Excel

Hi!

I'm trying to write a simple macro in Excel that will skim through my worksheets and tell me if something in the current column is not numeric. I've read a few sites that say you shouldn't use IsNumeric...but I want to. And I'm gonna.

So with that said, here's my problem. Before the following code even starts to execute, I get an error saying "Wrong number of arguements or invalid property assignment". Can anyone tell me what's going on here?

Code:
```Sub IsNumeric()
Dim c, k, l As Long
Dim s As String

l = Cells.SpecialCells(xlCellTypeLastCell).Row
c = ActiveCell.Column

For k = 1 To l
s = Cells(k, c).Text

If IsNumeric(s) = False Then
Cells(k, c).Activate
MsgBox "Non-Numeric characters found!"
Exit Sub
End If
Next k

MsgBox "Complete!" & vbNewLine & vbNewLine & "No alpha characters found!"

End Sub```

2. ## Re: IsNumeric in Excel

Try naming your subroutine "MyIsNumeric" ... just a quick guess.

3. ## Re: IsNumeric in Excel

OH WOW!!!! I'M A MORON!!!!! Let's write a sub with the same name as a function...it's brilliant!!!!

Thanks dude.

4. ## Re: [RESOLVED] IsNumeric in Excel

Note that IsNumeric("12d-2") returns true, and the same goes for "10e5", but not "7q3".

It's fine to use it as long as you don't care about things like that, but there are usually safer/better ways to check whatever it is you want.

On a separate note, you haven't declared your variables quite right, see this article for info: What's wrong with Dim x, y, z As Long ?

5. ## Re: [RESOLVED] IsNumeric in Excel

Ya I know - it should be c as long, x as long, blah blah. But it still works so meh. lol

Thanks though.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Featured