Hi, Thanks for the tip :) It is working without any error but there is another problem now. If i right the AT, or one of them it doesnt recognize... why it can be? Thanks
On Mar 23, 3:48 am, Ashish Jain <26may.1...@gmail.com> wrote: > Hi xmux, > > This is totally invalid, since you're applying OR on strings. You can > apply logical operators(AND,OR,NOT) on boolean values only whether > explicitly mentioned or returned from expressions like ischar(), a=b > etc. You can never OR two strings like this : "A" or "B". > > One of the way to come out of this error is to use code this way: > > If Selection.Cells(x, 8) <> "AD" Or Selection.Cells(x, 8) <> "AE" Or > Selection.Cells(x, 8) <> "AF" Or Selection.Cells(x, 8) <> "AG" Or > Selection.Cells(x, 8) <> "AI" Or Selection.Cells(x, 8) <> "AL" Or > Selection.Cells(x, 8) <> "AM" Or Selection.Cells(x, 8) <> "AN" Or > Selection.Cells(x, 8) <> "AO" Or _ > Selection.Cells(x, 8) <> "AQ" Or Selection.Cells(x, 8) <> "AR" Or > Selection.Cells(x, 8) <> "AS" Or Selection.Cells(x, 8) <> "AT" Or > Selection.Cells(x, 8) <> "AU" Or Selection.Cells(x, 8) <> "AW" Or > Selection.Cells(x, 8) <> "AX" Or Selection.Cells(x, 8) <> "AZ" Or > Selection.Cells(x, 8) <> "BA" Or Selection.Cells(x, 8) <> "BB" Or > Selection.Cells(x, 8) <> "BD" Or Selection.Cells(x, 8) <> "BE" Or > Selection.Cells(x, 8) <> "BF" Or Selection.Cells(x, 8) <> "BG" Or _ > Selection.Cells(x, 8) <> "BH" Or Selection.Cells(x, 8) <> "BI" Or > Selection.Cells(x, 8) <> "BJ" Or Selection.Cells(x, 8) <> "BM" Or > Selection.Cells(x, 8) <> "BN" Or Selection.Cells(x, 8) <> "BO" Or > Selection.Cells(x, 8) <> "BR" Or Selection.Cells(x, 8) <> "BS" Or > Selection.Cells(x, 8) <> "BT" Or Selection.Cells(x, 8) <> "BV" Or > Selection.Cells(x, 8) <> "BW" Or Selection.Cells(x, 8) <> "BY" Or > Selection.Cells(x, 8) <> "BZ" Or Selection.Cells(x, 8) <> "CA" Or _ > Selection.Cells(x, 8) <> "CC" Or Selection.Cells(x, 8) <> "CD" Or > Selection.Cells(x, 8) <> "CF" Or Selection.Cells(x, 8) <> "CG" Or > Selection.Cells(x, 8) <> "CH" Or Selection.Cells(x, 8) <> "CI" Or > Selection.Cells(x, 8) <> "CK" Or Selection.Cells(x, 8) <> "CL" Or > Selection.Cells(x, 8) <> "CM" Or Selection.Cells(x, 8) <> "CN" Or > Selection.Cells(x, 8) <> "CO" Or Selection.Cells(x, 8) <> "CR" Or > Selection.Cells(x, 8) <> "CS" Or Selection.Cells(x, 8) <> "CU" Or _ > Selection.Cells(x, 8) <> "CV" Or Selection.Cells(x, 8) <> "CX" Or > Selection.Cells(x, 8) <> "CY" Or Selection.Cells(x, 8) <> "CZ" Or > Selection.Cells(x, 8) <> "DE" Or Selection.Cells(x, 8) <> "DJ" Or > Selection.Cells(x, 8) <> "DK" Or Selection.Cells(x, 8) <> "DM" Or > Selection.Cells(x, 8) <> "DO" Or Selection.Cells(x, 8) <> "DZ" Or > Selection.Cells(x, 8) <> "EC" Or Selection.Cells(x, 8) <> "EE" Or > Selection.Cells(x, 8) <> "EG" Or Selection.Cells(x, 8) <> "EH" Or _ > Selection.Cells(x, 8) <> "ER" Or Selection.Cells(x, 8) <> "ES" Or > Selection.Cells(x, 8) <> "ET" Or Selection.Cells(x, 8) <> "FI" Or > Selection.Cells(x, 8) <> "FJ" Or Selection.Cells(x, 8) <> "FK" Or > Selection.Cells(x, 8) <> "FM" Or Selection.Cells(x, 8) <> "FO" Or > Selection.Cells(x, 8) <> "FR" Or Selection.Cells(x, 8) <> "GA" Or > Selection.Cells(x, 8) <> "GB" Or Selection.Cells(x, 8) <> "GD" Or > Selection.Cells(x, 8) <> "GE" Or Selection.Cells(x, 8) <> "GF" Or _ > Selection.Cells(x, 8) <> "GG" Or Selection.Cells(x, 8) <> "GH" Or > Selection.Cells(x, 8) <> "GI" Or Selection.Cells(x, 8) <> "GL" Or > Selection.Cells(x, 8) <> "GM" Or Selection.Cells(x, 8) <> "WS" Or > Selection.Cells(x, 8) <> "YE" Or Selection.Cells(x, 8) <> "YT" Or > Selection.Cells(x, 8) <> "ZA" Or Selection.Cells(x, 8) <> "ZM" Or > Selection.Cells(x, 8) <> "ZW" Then > MsgBox "Account Name cannot be empty! " & "Place: Row: " & x & > "Column: 8" > Debug.Print True > End If > > . > . > . > . > . > . > . > For more tips, tricks, downloads and problem solutions: visit > -->http://www.excelitems.com > ------------------------------------------------------------------------ > Regards > *Ashish **Jain* > Analyst, CSC Australia > Microsoft Certified Application (Excel) Specialist > Technical Trainer - Excel and VBA > Author ->www.excelitems.com +91-9999-40-48-43 > ----------------------------------------------------------------------------- > > On Mar 23, 3:54 am, xmux <kurtulu...@gmail.com> 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- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- 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 excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---