Use Like to compare strings : Like « String Functions « VBA / Excel / Access / Word






Use Like to compare strings

 
Sub CompareStrings()

    Dim strString1 As String
    Dim strString2 As String
    
    strString1 = "Microsoft"
    
    If strString1 Like "Micr*" Then
    Debug.Print "True"
    End If
    
    If strString1 Like "Mic*t" Then
    Debug.Print "True"
    End If
    
End Sub

 








Related examples in the same category

1.Wild Cards Used to Build Patterns with Like