opposite of IsNumeric

  • Thread starter Thread starter thephoenix12
  • Start date Start date
T

thephoenix12

Hi,

I know that IsNumeric returns true if the selection is only numbers
but is there a function that returns true if the selection is all text
Using If Not IsNumeric does not work, because if something contain
text and numbers it returns true, which is what I do not want.

Thanks,

Stev
 
It is not pretty, but if you had only numbers and/or letters and you wanted
to check for at least one number in the string:

Option Explicit
Sub AllText()
Dim i As Integer
Dim TestString As String
TestString = Range("A1")
For i = 1 To Len(TestString)
If IsNumeric(Mid(TestString, i, 1)) Then
MsgBox ("Not text")
Exit For
End If
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top