title: Error 1004 when using =AND(ISERROR) formula in macro
body: <p>I'm recording a macro to automate some Excel reports and have encountered the following bug whenever I try and run an iserror(search) formula:</p>
  
  <blockquote>
    <p>Run-time error '1004': Application-defined or object-defined error</p>
  </blockquote>
  
  <p>I have two lists. The formula iterates through the first list and compares the values with those of the second list, hiding any matching values.</p>
  
  <p>The formula in Excel is like this only with a wider criteria range:</p>
  
  <pre><code>=AND(ISERROR(SEARCH($B$3212,B2)),ISERROR(SEARCH($B$3213,B2)))
  </code></pre>
  
  <p>It works perfectly when I insert the formula directly into the spreadsheet cell however I get an error when I record and later run the macro using the same formula.</p>
  
  <p>EDIT 2</p>
  
  <p>I got the formula insertion to work through the macro but now I cannot filter the data as before, even when I do it manually without the macro. </p>
  
  <p>Below is a link to a picture giving an example of the type of lookup I'm trying to achieve, previously it worked perfectly and removed all the rows which contained a string from the 'to remove list' now I cannot get it to filter at all. I've tried removing the macro after saving in notepad in case the file had become corrupted but it still does not filter as before. What could be causing this?</p>
  
  <p><a href="https://i.stack.imgur.com/I85EU.png" rel="nofollow noreferrer">This is how the lookup works</a></p>
  
  <p>Cell [A13] would contain the aforementioned ISERROR formula in this example.</p>