View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Matilda Matilda is offline
external usenet poster
 
Posts: 57
Default test if a character in a string is alpha

Dear All,

I need to convert part of a string to a number. the string can be x
characters long, but I only want the first teo characters, where they are
numbers.

I am having trouble catching cases where wither first or second character is
alpha.

If (Mid(sshift, 2, 1) = "A") Or (Mid(sshift, 2, 1) = "P") Then
iShftStart = CInt(Left(sshift, 1)) ' case where shift is written as 8AM or
8PM
Else
iShftStart = CInt(Left(sshift, 2))
End If

my conditions need to include any ascii alpha character, really.

Any suggestions?


Many thanks,

Matilda