How to do string comparison in VBA if a string has an inequality operator?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How to do string comparison in VBA if a string has an inequality operator?



I have an Excel sheet that can have the following string in one of its cells:


Valid Test for ≥ 30% ABCD?



When I capture this value in a variable and output it in the Immediate window, it looks like this:


?strVal
Valid Test for = 30% ABCD?



I want to check whether the cell contains this value, and currently I'm using:


Select Case strVal
Case "Valid Test for = 30% ABCD?"
doSomething
'... other Case statements
Case Else
doSomethingElse
End Select



This string match always fails, though, and I get the following results when I investigate in the Immediate window:


?strVal="Valid Test for = 30% ABCD?"
False

?asc(mid(strVal,16,1))
61

?asc("=")
61



So apparently what's happening here is that the "≥" symbol is being rendered in VBA output as "=" both in appearance and ASCII code, but somehow it's still not equivalent to "=" in string comparison. How can I get the string match that I'm looking for?









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Stripe::AuthenticationError No API key provided. Set your API key using “Stripe.api_key = ”

CRM reporting Extension - SSRS instance is blank

Keycloak server returning user_not_found error when user is already imported with LDAP