We have been debating whether or not to buy iPhone. For one, we are not on any cellular contract and free to go. But the sheer cost of $400 one time (one for my wife and one of me) and a monthly bill of ~ $150 is holding us back. Our current mobile bill is roughly $80 per month and when we choose to go back home we can just takeout the SIM Cards and thrash it without having to bother about paying any contract breakage (incidentally for iPhone this could be as much as $175 per line). On the other hand, the iPhone is excellent value for money for the awesome features it provides. Our current phones were bought at Rs. 10,000 a piece (roughly $250), even though they were world class when we bought them 2 years back and still work well, their features are no where comparable to that of iPhone’s. Hmm…
Here are few excellent excel links from the last week around the web:
- Learn about excel category axis, find out how to use dates, numbers, text etc. on category axis for charts. See how you can tweak the axis to get the outcome you want (for ex: How to show weekdays on a date axis, how to configure axis for stock ticker charts etc.)
- If you are the kind who would install lots of add-ins to do your work, then you may be wondering how to find out what are the add-ins you have in place. Find out all the COM add-ins you have installed in Excel from Daily dose of Excel
- Winners of 2008 Excel Dashboard competition, see the beautiful and informative dashboards here 1, 2 and 3. The winner got an iPhone, alas, if only I knew about this earlier, I would have wondered “how to dashboard” instead of “to iPhone or not to iPhone”.
Got a hot excel tip to share, drop me an email or leave a comment.

















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