-
Solved: If Statement Insanity
What is wrong with this IF statement?
[vba]
If Not ((UCase(countryRange.Value) = "US") Or (UCase(countryRange.Value) = "PR") Or (UCase(countryRange.Value) = "VI") Or (UCase(countryRange.Value) = "GU")) Then ' if not US or PR or GU or VI
Debug.Print countryRange.Value
[/vba]
This is getting a lot of rows returning saying "US" even though the IF statement explicitly catches the US country code..What am I doing wrong?
Last edited by Aussiebear; 12-27-2012 at 02:39 AM.
Reason: Adjusted the tags to the correct usage
-
Nevermind, i forgot to Trim the variable i was checking...
-
This syntax might be more readable
[VBA]Select Case UCase(countryRange.Value))
Case "US", "PR", "VI", "GU"
' do nothing
Case Else
Debug.Print countryRange.Value
End Select[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules