Home > How-To Library > String Manipulation

How to Check whether the given string has only numbers

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************
Public Function isTypeNumberWithChar(ByVal strTestString As String) As Boolean Dim intCount As Integer isTypeNumberWithChar = True For intCount = 1 To Len(strTestString) If Not IsNumeric(Mid$(strTestString, intCount, 1)) Then Exit Function Next intCount isTypeNumberWithChar = False End Function 'How can I call this function: 'Debug.Print isTypeNumberWithChar("06040031") 'Debug.Print isTypeNumberWithChar("0604d0031")

If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.