Need to search a string for numbers
Try this code as an example
Sub NumericCheck()
Dim mString As String, mChar As String
Dim i As Integer
mString = InputBox("Enter in a String")
For i = 1 To Len(mString)
mChar = Mid(mString, i, 1)
If IsNumeric(mChar) Then
MsgBox "This string has numbers in it"
Exit Sub
End If
Next i
MsgBox "This string conatined no numbers"
End Sub
Sandy
havocdragon wrote:
Hi all! What I am trying to do sounds like it should be easy, but it is not
working for me...Here is what I am trying to do...
User pushes a button that brings up an input box, the value typed in that is
saved as 'ColumnBox'. I then Want to check ColumnBox to see if it has numbers
in it, if it does, I want to produce an error (which I can do the error part
fine), or if there is no number than continue the procedure.
Any ideas? Ive been trying combonations of InStr and Isnumeric, but nothing
works 100%
|