Dear all, I've found and amended a small procedure called "SplitDemo" to search a string held in a cell to find a 3 digit code in that string - which works. I've tried improving it using a function called "ISLIKE" from a John Walkenback book (Excel 2010 Formulas p687) but it doesn't work. The line that seems to be causing the problem is below in the code 6 lines from the bottom. Can anyone help? I've attached a sample file, thanks, Neil
![]()
Public Function islike(text As String, pattern As String) As Boolean 'returns true if the first argument is like the second islike = text Like pattern End Function Public Sub SplitDemo2() Dim txt As String Dim x As Variant Dim i As Long Dim t As Boolean txt = ActiveCell.Value x = Split(txt, " ") For i = 0 To UBound(x) Debug.Print x(i) If Len(x(i)) = 3 Then If t = islike("'" & x(i) & "'", "###") Then 'Get a Byref argument type mismatch error here! MsgBox x(i) & " is a match" End If End If Next i End Sub
Bookmarks