title: VBA to check if cell contains anything from a list
body: <p>I'm trying to get a mini calendar thing going in Excel and I need a way to automatically input a background colour on certain days depending on the users location.</p>
  
  <p>I've got something that works for individual criteria here:</p>
  
  <pre><code>Sub Autofilldays()
  
  'First column to check is located in cell B79
  'Value to check for is located in cell H28
    For i = ActiveSheet.Columns.Count To Range("B79") Step -1
          If InStr(1, Cells(6, i), Range("H28")) Then Columns(i).Rows("7:19").Interior.Color = rgb(201, 201, 201)
  
  Next i
  End Sub
  </code></pre>
  
  <p>It pulls the first column to start searching from cell B79 (the first column depends on user input somewhere else) and if it matches the contents of cell H28 it colours rows 7 to 19 in the same column.</p>
  
  <p>That works great but I also need something that can do the same thing but for a larger range of criteria, so if the searched cell contains anything kept in cells H28:H50 (for example) then colour the same rows as before.</p>
  
  <p>I can't for the life of me work out if that's possible and, if it is, what syntax it wants to see. Unfortunately it isn't as simple as changing</p>
  
  <pre><code> If InStr(1, Cells(6, i), Range("H28"))
  </code></pre>
  
  <p>to </p>
  
  <pre><code> If InStr(1, Cells(6, i), Range("H28:H50"))
  </code></pre>
  
  <p>I wish it was though!</p>
  
  <p>I'm going to have, potentially, 100 different possible criteria in this range so using lots of OR isn't going to be feasible. If anyone has any idea what I should be looking for I'd greatly appreciate it.</p>