CheckUSState – Validate a US state initial

' Return True if the passed State initials are valid' Example:'    MsgBox CheckUSState("NY")Public Function CheckUSState(ByVal State As String) As Boolean    If Len(State) = 2 And InStr(",AL,AK,AZ,AR,CA,CO,CT,DE,DC,FL,GA,HI,ID,IL,IN,I" _        & "A,KS,KY,LA,ME,MD,MA,MI,MN,MS,MO,MT,NE,NV,NH,NJ,NM,NY,NC,ND,OH,OK,OR,P" _        & "A,RI,SC,SD,TN,TX,UT,VT,VA,WA,WV,WI,WY,", "," & UCase(State) & ",") > _        0 Then        CheckUSState = True    End IfEnd Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: