This is a personal note, not an Excel tip. So relax, grab a cup of coffee & read on.
Two years ago, If someone told me I would be flying to Australia & get handsomely paid to do it, I would have rubbished the thought. You see, exactly two years ago, I quit my job to work on Chandoo.org for full time.
My main focuses then were,
- to make sure my family would not starve or be deprived.
- to make you awesome in Excel
Today, #1 does not keep me up in the night. Thanks to you. You have supported Chandoo.org, purchased our products, spread good word about our site. This removed all my doubts & financial worries. Now, most of my work day is focused on making you awesome in Excel.
Thank you
I just want to thank you for your continued support. With out that I would not have the courage to even dream about my Australian workshops, let alone actually selling them out.
Thank you, for inspiring me to learn & share
Thank you, for supporting what we do
Thank you, for showing new opportunities
Thank you, for enabling me realize my dreams
Thank you, for helping me get a car & house
Thank you, for taking time to learn & be curious
Thank you, for loving & making us a part of your life
Thank you.
PS: If you live in Sydney, Brisbane or Melbourne – lets catch up
We are conducting drinks with Chandoo events in Sydney, Brisbane and Melbourne.
- Monday 30th April, Sydney from 5pm at The Opera Bar, Lower Concourse, Sydney Opera House
- Thursday 31st May, Brisbane from 5.30pm at Jade Buddha , 1 Eagle st, Eagle st Pier, Brisbane
- Thursday 7th June, Melbourne from 5.30pm at The Wharf Hotel, WTC Wharf – Riverside (World Trade Centre)
18-38 Siddeley street, Melbourne
I would love to catch up with you and toast for your happiness, wealth & health. Come join us. Click here for details.

















6 Responses to “Make VBA String Comparisons Case In-sensitive [Quick Tip]”
Another way to test if Target.Value equal a string constant without regard to letter casing is to use the StrCmp function...
If StrComp("yes", Target.Value, vbTextCompare) = 0 Then
' Do something
End If
That's a cool way to compare. i just converted my values to strings and used the above code to compare. worked nicely
Thanks!
In case that option just needs to be used for a single comparison, you could use
If InStr(1, "yes", Target.Value, vbTextCompare) Then
'do something
End If
as well.
Nice tip, thanks! I never even thought to think there might be an easier way.
Regarding Chronology of VB in general, the Option Compare pragma appears at the very beginning of VB, way before classes and objects arrive (with VB6 - around 2000).
Today StrComp() and InStr() function offers a more local way to compare, fully object, thus more consistent with object programming (even if VB is still interpreted).
My only question here is : "what if you want to binary compare locally with re-entering functions or concurrency (with events) ?". This will lead to a real nightmare and probably a big nasty mess to debug.
By the way, congrats for you Millions/month visits 🙂
This is nice article.
I used these examples to help my understanding. Even Instr is similar to Find but it can be case sensitive and also case insensitive.
Hope the examples below help.
Public Sub CaseSensitive2()
If InStr(1, "Look in this string", "look", vbBinaryCompare) = 0 Then
MsgBox "woops, no match"
Else
MsgBox "at least one match"
End If
End Sub
Public Sub CaseSensitive()
If InStr("Look in this string", "look") = 0 Then
MsgBox "woops, no match"
Else
MsgBox "at least one match"
End If
End Sub
Public Sub NotCaseSensitive()
'doing alot of case insensitive searching and whatnot, you can put Option Compare Text
If InStr(1, "Look in this string", "look", vbTextCompare) = 0 Then
MsgBox "woops, no match"
Else
MsgBox "at least one match"
End If
End Sub