Results 1 to 6 of 6

Using the Split function with another function incorporated is not working correctly

Threaded View

highlystrung Using the Split function with... 05-06-2013, 10:43 AM
AndyLitch Re: Using the Split function... 05-06-2013, 10:54 AM
highlystrung Re: Using the Split function... 05-06-2013, 11:28 AM
tigeravatar Re: Using the Split function... 05-06-2013, 11:46 AM
AndyLitch Re: Using the Split function... 05-06-2013, 12:05 PM
highlystrung Re: Using the Split function... 05-06-2013, 03:51 PM
  1. #1
    Forum Contributor
    Join Date
    04-13-2011
    Location
    Havant, Hants, England
    MS-Off Ver
    Excel 2010
    Posts
    116

    Using the Split function with another function incorporated is not working correctly

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1