我需要过滤超过 50000 行的 excel 表 512 次。我目前正在使用以下代码。
Do While Not IsEmpty(ActiveCell.value)
Worksheets("Sheet1").Activate
filtro = ActiveCell.value
Sheets("Sheet2").Select
Range("D1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$I$" & lastRow("D")).AutoFilter Field:=4, Criteria1:=filtro
Range("A1").Select
Do While Not IsEmpty(ActiveCell.value)
Do
ActiveCell.offset(1, 0).Select
oProgress.Increase 1
Loop While ActiveCell.EntireRow.Hidden = True
Call functio ' this function do something with the actual row
Loop
Loop
问题是分析 50000 行 X 512 次需要花费大量时间!我在想也许最好先过滤然后将行复制到临时工作表中,然后检查那里的值?
行 Active 由函数 readValues 处理