title: VBA error: Object variable or with variable not set
body: <p>I receiving a strange error when running this subroutine in VBA:</p>
  
  <pre><code>Sub NameColumns()
  ' name key columns for later reference in formulas
  Dim startdatecol As Integer
  
  ' name start date column
  startdatecol = ActiveSheet.Cells.Find(What:="Start Date", after:=[a1], LookIn:=xlValues, _
  LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
  MatchCase:=False, SearchFormat:=False).Column
  End Sub
  </code></pre>
  
  <blockquote>
    <p>Run time error '91': Object variable or With variable not set</p>
  </blockquote>
  
  <p>Any ideas on how I can fix this subroutine error? And why it is occurring?</p>
  
  <p>Thanks,
  AME</p>