Hi Team,
Need help , Instr function not working as per my expectation.
I want loop to go inside if not found [ does not contain )
How to search multiple value does not contain using instr. Can we reduce code here.
Thanks
mg
Need help , Instr function not working as per my expectation.
I want loop to go inside if not found [ does not contain )
How to search multiple value does not contain using instr. Can we reduce code here.
VBA Code:
Option Explicit
Sub test()
Dim str As String
str = "Fruit - [B]Coconut[/B]"
If InStr(1, str, "apple", vbTextCompare) = 0 Or _
InStr(1, str, "Mango", vbTextCompare) = 0 Or _
InStr(1, str, "Chikoo", vbTextCompare) = 0 Or _
InStr(1, str, "WaterMellon", vbTextCompare) = 0 Or _
InStr(1, str, "Banana", vbTextCompare) = 0 Then
MsgBox str & " not Found"
Else
[B]MsgBox str & " not Found" 'msgbox "fruit Not Found"[/B]
End If
End Sub
Thanks
mg