title: Excel VBA range.find acting up
body: <p>Im trying to use range.find to look up a value within a column, and return the matching value from the next column.</p>
  
  <p>I recorded the find() using the macro recorder, which seemed to work fine for a while, but for some reason it's now giving me an error. As far as I can tell I haven't changed anything that should affect this bit of code.</p>
  
  <p>This is what I have</p>
  
  <pre><code>Public Function look_up_id(id, table)
      Worksheets(table).Activate
      Cells.Find(What:=id, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
          :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
          False, SearchFormat:=False).Activate
  
      look_up_id = ActiveCell.Offset(0, 1).Value
  End Function
  </code></pre>
  
  <p>The error I'm now getting is:</p>
  
  <blockquote>
    <p>Object variable or With block variable not set</p>
  </blockquote>
  
  <p>Any idea why this is now happening?</p>
  
  <p>All the resources I can find on range.find() look like I'm doing it right...</p>
  
  <p>Cheers - David</p>