title: VBA filter result row count wrong
body: <p>Language: Excel VBA</p>
  
  <p>Scenario:
  I have a source range (rngDTRef_AllRecord) that i need to insert the data into the destination range (rngRTDC_AllDetail)</p>
  
  <p>for each of the row(rngCurrRow) in the source range (rngDTRef_AllRecord), it will filter the destination range (rngRTDC_AllDetail)</p>
  
  <p>if the filter yield result, it will add some data to the result row (Note: each of the result is unique)</p>
  
  <p>else it will add a new row to the destination range (rngRTDC_AllDetail)</p>
  
  <p>below is the code:</p>
  
  <pre><code>    For Each rngCurrRow In rngDTRef_AllRecord.Rows
          intRTDC_RowBegin = 7
          intRTDC_ColIdxTotal = 20
          intRTDC_RowLast = fntGetNewLastRow 'this is some function get last row of rngRTDC_AllDetail due to might add in new row
          Set rngRTDC_AllDetail = shtRTDC.Range(shtRTDC.Cells(intRTDC_RowBegin, 1), shtRTDC.Cells(intRTDC_RowLast, intRTDC_ColIdxTotal))
  
          rngRTDC_AllDetail.AutoFilter
          rngRTDC_AllDetail.AutoFilter Field:=intRTDC_ColIdxAcc, Criteria1:=rngCurrRow.Cells(1, intDTSource_ColIdxAccCode), Operator:=xlAnd
          rngRTDC_AllDetail.AutoFilter Field:=intRTDC_ColIdxText, Criteria1:=rngCurrRow.Cells(1, strCurrAccCodeText), Operator:=xlAnd
  
          Dim rngResult As Range
          Set rngResult = rngRTDC_AllDetail.rows.SpecialCells(xlCellTypeVisible)'rngRTDC_AllDetail.SpecialCells(xlCellTypeVisible) also not work
  
          'after filter, it will be only 1 result or none
          If (rngResult.Rows.Count &gt; 0) Then 
              'if the filter have result, do something here.
          else
              'add new row
          End If
      Next
  </code></pre>
  
  <p>My problem is after the filter, from the excelworksheet, i can see that have only 1 record, but
  rngResult.Rows.Count = 2 'for the first filter record (that have 1 row only) in rngRTDC_AllDetail, i suspect due to it include the header, but i am not sure what wrong.</p>
  
  <p>rngResult.Rows.Count = 1 'for the rest of the filter record that have 1 row</p>
  
  <p>even worse is when there is no record after the filter, rngResult.Rows.Count = 1</p>
  
  <p>Any advice will be appreciate. TQ.</p>