VBA SEARCH IN STRING INSTR CASE INSENSITIVE

InStr specification:
Instr( [start], string, substring, [compare] )

MsgBox InStr("Hi there", "THERE")
' will return 0, as "THERE" doesn't match the case:

' use vbTextCompare to make the search case insensitive:
MsgBox InStr(1, "Hi there", "THERE", vbTextCompare)
' will return 4

Recent Posts

Recent Comments

Meta

Written by:

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *