Time for blowing my own trumpet and patting my own back over my pointy hair. I feel very proud to announce that our little community at Pointy Haired Dilbert now has its five thousandth member.
Take a minute and pat yourself on the back. This is an achievement because of you. Go ahead, I am waiting.
Ok, enough patting. Time for some gifts and fun.
We have 2 contests to celebrate the occasion. This is the first one. I will announce the second contest tomorrow.
Twitter formula contest.. What?
It is as simple as leaving a twitter. All you have to do is write a formula less than 140 characters and tweet it. It could be a complex array formula to solve the world hunger, or just a regular vlookup with wild card search.
Just follow these guidelines:
- The formula should be self explanatory
- Or the formula should be short so that you can squeeze the explanation in the tweet itself
- Either include @r1c1 in the tweet or post the permalink to your tweet in the comments. Otherwise I cant locate your tweet and hence you wont get the prizes
- Dont post formulas that are way simple like sum(1,2,3)
- Finally, if you don’t have a twitter account, you can post your formula in the comments. Character count still remains.
- You can post as many tweets as you want.
- Winners will be selected randomly. So post anything as long as it is good.
- The contest is closes on 15th August midnight (at where I sleep)
What are the prizes?
There are two prizes.
Excel Dashboard Bundle sponsored by Bonavista Systems.
Andreas, who owns the company has been kind enough to sponsor this prize. The dashboard bundle includes two kickass products from BonaVista systems – Excel Microcharts and Chart Tamer [My review of chart tamer here].
This prize is worth $200.
Excel 2007 Formulas by John Walkenbach
J Walk, who probably authored a zillion excel books provides a complete reference of Excel 2007 formulas in this wonderful book. The book is a must have for both excel beginners and more advanced users. And it is just a tweet away to become yours.
This prize is worth $28.
Any doubts?
Leave a comment or tweet me @r1c1.
No doubts?
Good, what are you waiting for then? Get tweeting.

















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