An Alternative Solution:
Public Function IsAcct(code As String) As Boolean
Dim Acct
Dim Found As Boolean
Acct = Array( _
"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", _
"AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", _
"BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", _
"BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", _
"CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", _
"CM", "CN", "CO", "CR", "CS", "CU", "CV", "CX", "CY", _
"CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", _
"EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", _
"FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", _
"GI", "GL", "GM", "WS", "YE", "YT", "ZA", "ZM", "ZW")
code = StrConv(Trim(code), vbUpperCase) ' Upper-case no blanks
Found = False
For i = 0 To UBound(Acct)
If Acct(i) = code Then
Found = True
Exit For
End If
Next
IsAcct = Found
End Function
On Sun, Mar 22, 2009 at 6:54 PM, xmux <[email protected]> wrote:
>
> Hi Everyone,
>
> I am just checking a Cell with
>
> If Selection.Cells(x, 8) <> _
> "AD" Or "AE" Or "AF" Or "AG" Or "AI" Or "AL" Or "AM" Or "AN" Or "AO"
> Or "AQ" Or "AR" Or "AS" Or "AT" Or "AU" Or _
> "AW" Or "AX" Or "AZ" Or "BA" Or "BB" Or "BD" Or "BE" Or "BF" Or "BG"
> Or "BH" Or "BI" Or "BJ" Or "BM" Or "BN" Or _
> "BO" Or "BR" Or "BS" Or "BT" Or "BV" Or "BW" Or "BY" Or "BZ" Or "CA"
> Or "CC" Or "CD" Or "CF" Or "CG" Or "CH" Or _
> "CI" Or "CK" Or "CL" Or "CM" Or "CN" Or "CO" Or "CR" Or "CS" Or "CU"
> Or "CV" Or "CX" Or "CY" Or "CZ" Or "DE" Or _
> "DJ" Or "DK" Or "DM" Or "DO" Or "DZ" Or "EC" Or "EE" Or "EG" Or "EH"
> Or "ER" Or "ES" Or "ET" Or "FI" Or "FJ" Or _
> "FK" Or "FM" Or "FO" Or "FR" Or "GA" Or "GB" Or "GD" Or "GE" Or "GF"
> Or "GG" Or "GH" Or "GI" Or "GL" Or "GM" Or _
> "WS" Or "YE" Or "YT" Or "ZA" Or "ZM" Or "ZW" Then
> MsgBox "Account Name cannot be empty! " & "Place: Row: " & x & "
> Column: 8"
> GoTo Einde
> End If
>
> If i run the Macro i got the run time Error!
> Anyone has any idea?
>
>
> Thanks
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
To post to this group, send email to [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain @ [email protected] or
Ashish Jain @ [email protected]
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---