title: Using CountIf under a header VBA
body: <p>I am using a countif function to check if I need to use autofill, but I encountered a problem where my raw data had two entries but these were merged together in my destination sheet. I can't use a form of unique count if as when these cases occur, they will not have the same reference anywhere, but are linked. Is there a way to countif on my destination sheet under the header?</p>
  
  <pre><code>If WorksheetFunction.CountIf(wksdata.Range("D:D"), "MAN002") &gt; 1 Then 
  wksdestination.Range("B6:R6").AutoFill Destination:=wksdestination.Range("B6:R" &amp; Lastrow)
  End If
  </code></pre>
  
  <p>This caused the macro to break as it was trying to autofill to the bottom of the sheet, a count of cells from A6 down would be ideal, A5 has a title in it, A3 has the word "Month" and A1 and A2 are merged to form A1:L1 and A2:L2 respectively.</p>