VBA EXCEL usage.like

Solved
Sansandrine Posted messages 94 Status Member -  
Sansandrine Posted messages 94 Status Member -
Hello,

I use the formula If range("b2") like "*rdc*" ... to apply formatting to a part when the word rdc appears in the phrase located in B2. But I would like to add a condition like: if there is "rdc" or "etage" or "grenier" and I can't find how to do the "OR" with the like function.
Can someone help me?

Thanks in advance

Configuration: Windows XP / Firefox 3.6.2

1 answer

  1. chossette9 Posted messages 6855 Registration date   Status Contributor Last intervention   1 313
     
    Hello,

    in VBA, the logical operator OR is "Or". In your formula, it would be:
    If Range("B2") like "*rdc*" Or Range("B2") like "*etage*" Or Range("B2") like "*grenier*" Then


    Best regards.
    --
    That guy wasn’t very bright, because he was foolish.
    3
    1. Sansandrine Posted messages 94 Status Member
       
      Thank you very much!
      I knew that OR was there, but I didn't know how to place it in the sentence...
      0