title: Replacing error #N/A with today's date in VBA
body: <p>I am looking to replace <code>#N/A</code> (resulted due to lookup search) with today's date by using the below code however its not working. Could you please advise if this logic works or need to apply some other technique.</p>
  <pre><code>Const StartRow As Byte=2
  LastRow = Range(&quot;J&quot; &amp; Rows.count).End(xlUp).Row
  
  For i = StartRow To LastRow
  
      myValue = Range(&quot;B&quot; &amp; i).Value
  
      If myValue =Specialcells(xlCellTypeFormulas,xlErrors) 
            Then Range(&quot;B&quot; &amp; i).Value = &quot;=Today()&quot;
  
    Next i
  </code></pre>