Thread: text or numeral
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default text or numeral

I am a newbie in excel VBA.
I attempt to set a condition to test cells property.
1. The cell have 5 characters
2. The first 2 characters are letters
3. The last 3 characters are numeral


Test the contents of your Cell like this...

If ContentsOfCell Like "[a-zA-Z][a-zA-Z]###" Then
' cell contents are 2 letters followed by 3 numbers
End If

Rick