VB and VBA Users Source Code: Determine if all the characters in a string are Alpha
[
Home
|
Contents
|
Search
|
Reply
| Previous | Next ]
VB/VBA Source Code
Determine if all the characters in a string are Alpha
By:
Andrew Baker
Email (spam proof):
Email the originator of this post
Date:
Tuesday, March 06, 2007
Hits:
5626
Category:
Visual Basic General
Article:
Below is a simple function to determine if all the characters in a string are alpha characters (a text equivalent of IsNumeric). 'Purpose : Determines if all the characters in a string are alpha characters. 'Inputs : sText The test to check. 'Outputs : Returns true if all the characters are alpha, else false. 'Author : Andrew Baker 'Date : 25/03/2001 'Notes : Public Function IsAlpha(sText As String) As Boolean Const VALID_CHARS As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Dim lThisChar As Long, sThisChar As String For lThisChar = 1 To Len(sText) sThisChar = Mid$(sText, lThisChar, 1) If InStr(VALID_CHARS, sThisChar) = 0 Then IsAlpha = False Exit Function End If Next IsAlpha = True End Function
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder