当我应用filter并运行macros时得到错误的行数

我写了一个macros,它工作正常,但我得到了一些问题,即时通讯无法解决it.i无法发布的代码,因为它近800行和macros是关于导入新的代码是独一无二的,所以我已经运行macros没有过滤任何列的第一次,它工作正常,但后来应用自动filter的列和过滤一些行,并开始运行的macros,它仍然工作正常,但是当我运行macros,下一次数行计数显示不同

情况1

I have 35000 rows in my workbook that are old and run the macro working fine imported 100 unique rows 

情况2

 i have closed and reopened the file and now applied filters to the sheet and the last row that i can see is 24000 but rows count is still 35000 in vba thats what i wanted , then run macro it gave 100 and working fine 

情况3

 now i have reopened my workbook and run the macro as normal then applied filters for the sheet that has both newly imported and old entries now it gives 24000 as rows count that is where the last filtered row is 

但总数应该是35000,有谁能告诉我为什么?

当我通过在新的工作簿上进行实验,尝试了越来越多的时候,我得到了自己的问题的解决scheme,我观察到的是

 rows= activesheet.Cells(Rows.count, 1).End(xlUp).Row 

当不应用filter时,提供35000

 rows= activesheet.Cells(Rows.count, 1).End(xlUp).Row 

给出24000,因为这是最后一行,可以看到使用filter,这就是它返回。

我已经尝试了一个小的新的工作簿中的一些随机值在10个单元格,并采取了计数,它给了我10作为答案,然后我应用filter的值最后一次发生是6,然后surpultly,它返回值作为6,那么我明白了它在做什么

  A 1 2 3 4 5 1 6 2 3 4 

没有filter我得到了10作为计数现在我应用filter的价值1,然后我得到了计数为6,这是1最后发生的地方是。使用filter时要小心:)

我希望它能帮助其他人看到这些post谢谢!