View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Ken Hudson Ken Hudson is offline
external usenet poster
 
Posts: 186
Default opposite of IsNumeric

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
--
Ken Hudson


"thephoenix12" wrote:


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 contains
text and numbers it returns true, which is what I do not want.

Thanks,

Steve


--
thephoenix12
------------------------------------------------------------------------
thephoenix12's Profile: http://www.excelforum.com/member.php...o&userid=24336
View this thread: http://www.excelforum.com/showthread...hreadid=381732