Almost there with complex expression

mitchem1

Registered User.
Local time
Today, 00:04
Joined
Feb 21, 2002
Messages
153
Is there a way to check if the last character in a string is a certain data type? For example, for the following strings, I need to do one thing if the last character is text, another if it is a number:

7E85C
7E1009
7E14
7E1411A
7E827

Thanks.
 
Use the Right() Function to extract the far-right character.
Like this...
Dim lastChar
lastChar = Right(YourVariable,1)

'Now convert the lastChar Value to ASCII and check to see what the Ascii Value is.

'If the Ascii value of the extracted character is 65-90 OR 97-122 Then it is an Alpha Character, otherwise, it is a numeric.

Let me know if you need more help with the actual ASCII conversion code.
 
Thanks, I'll give it a shot.
 

Users who are viewing this thread

Back
Top Bottom