So, I have a function created to check an array for matching values. The problem I'm having is that the function is finding a match for approximate values. For example, if I choose "Josh" and the values I'm checking against include just that text imbedded within them (ex. "Josheroni"), it's finding "Josheroni" as well as "Josh." I am trying to find a way to amend my existing code to only match exact values. Please help if you can. Code is below:
Sub blah()
Dim blahber As Variant, ron As String
blahber = Array("Josh", "Josher", "Josheroni")
ron = "Josh"
For Each stuff In blahber
if IsInArray(ron, blahber) then
msgbox stuff
end if
Next stuff
End Sub
Public Function IsInArray(stringToBeFound As String, arr As Variant) As Boolean
IsInArray = (UBound(Filter(arr, stringToBeFound)) > -1)
End Function
Bookmarks