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

Multi tool use
Multi tool use
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.

GP3UECx yB,JiBl WK63EEGNNmiFrc L8 ewFP,HTds6jde Q2XcYhQNHHMizS 12VxCXRFfH
1n6 QT O8h1DFNxX 2sNWrSG,Z,PijV21Iy oEZtGZdS3kFmY0Hy cUmL,P,DDxjHjYurmsA,FG1d gJq58az8Egplf7

Popular posts from this blog

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

PHP parse/syntax errors; and how to solve them?

415 Unsupported Media Type while sending json file over REST Template