Hi to everyone ,how can i use the Like expression with an AND or OR logical operator (If that is possible). Regards
Hi to everyone ,how can i use the Like expression with an AND or OR logical operator (If that is possible). Regards
Last edited by ksilenio; 10-31-2019 at 04:00 PM.
Hi ksilenio!
Simple example like below:
Sub test() Dim s$ s = "abcdef" If s Like "*def" Or s Like "xyz*" Then MsgBox "Yes" Else MsgBox "No" 'This is right use If s Like "*def" And s Like "xyz*" Then MsgBox "Yes" Else MsgBox "No" 'This is right use If s Like ("*def" Or "xyz*") Then MsgBox "Yes" 'This is wrong use End Sub
To keep your code readable:
Sub test() c00 = "abcdef" MsgBox Format(c00 Like "*def" Or c00 Like "xyz*", "yes/no") End Sub
Thank you very much for your answer
Redards