January 2009 will be one of the most memorable months since I started blogging. It is a perfect example of how uncertain life is. The month started with me receiving MVP award, then the website went down due to excessive server load and then we crossed 2000 RSS subscribers milestone and celebrated it with a huge 100 excel tips post. It just shows how uncertain things can be.
We had 105k page views from 47k visitors in Jan 2009 despite the server outages. Our e-mail subscriber base crossed 500 members and total RSS subscriber base is now at 2040. There were 19 posts and 247 comments (wow) in last month. I am really thankful to our readers. You constantly motivate me to learn and share beautiful things about excel and charting. The journey is becoming more and more enriching each day for me. I hope you are enjoying the ride as much.
Here is a list of 5 best posts from Jan 2009, in case you have missed out the whole month or new to this blog, check this posts out to make sure you have squeezed enough from this blog.
– Automatically Insert Time Stamps in Excel [12 comments]
– Excel Formula Wish list [25 comments]
– 6 ways to stack your column charts [17 comments]
– Hide worksheet tabs in excel [14 comments]
– 100 Excel Tips & Resources [10 comments]
PHD needs your help, Please
Please take a moment and help me spread this blog. You can easily help by just saving this blog to your technorati favorites or delicious bookmarks or stumbleupon pages or emailing a friend about this site. That is a all it takes, just few clicks to show your love and support.
You can also help me by making PHD a better place. Please suggest article ideas, guest contributions, tips or just say “hello” by writing to me at chandoo . d @ gmail.com. I don’t know how you feel seeing emails from strangers, but I really *love* seeing emails from strangers.
Have a great february everyone. We have some delicious posts coming up, so stay tuned and stay happy.

















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