循环遍历excel中的过滤值

时间:2015-12-08 06:33:12

标签: vbscript excel-2007

我正在尝试在excel表格中的列上自动应用过滤器,我必须遍历不同列上可用的过滤值。我不知道如何遍历过滤后的值?

在第19列上应用过滤器。有必要遍历第12列的可用值。

  strPath="C:\Users\PSi\Desktop\CodeIn.xlsx"

    Dim ProcessName

    ProcessName=Trim(InputBox("Process Name:"))
    Set objExcel= CreateObject("Excel.Application")
    objExcel.Visible= True

    objExcel.Workbooks.Open(strPath)

    With objExcel.Activeworkbook.Sheets("All")

        .Range("A1").AutoFilter 19,"="&ProcessName

    End With
    'How to loop through the filtered values ??
    'Need to loop through only on the above filtered values..
     for i=2 to (How to get end of filtered used rows)

if Mid(objExcel.Activeworkbook.Sheets("All").Cells(i,12).Value,1,3)="Seq" 
    Then msgbox objExcel.Activeworkbook.Sheets("All").Cells(i,12).Value
End if
      Next

0 个答案:

没有答案