none
Range.AutoFilter method on a ListObject table in Excel. How can I refer to the filtered rows ? RRS feed

  • Question

  • VS2010 + VSTO + Excel2010

    I am able to generate a filter using the Range.AutoFilter method on a ListObject table in Excel.

    However, I cannot find a way to refer to the filtered rows.

    I tried all possible sintax and searched for hours to find an answer, but with no success.

    How can such a simple thing cost so much time ? Please help !

    Thank you


    joPol

    Thursday, February 7, 2013 3:40 PM

Answers

All replies

  • Hi joPol,

    Thanks for posting in the MSDN Forum.

     However, I cannot find a way to refer to the filtered rows.

    Would you please clarify it? It's based on my understand that you want to refer the result range for the AutoFilter, is it right?

    Please use AutoFilter.Range to access that if it is right.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, February 8, 2013 5:25 AM
    Moderator
  • Thank you very much for your answer Tom !

    Here is what a mean:

    1. I used the followimg filter: Globals.ThisWorkbook.Sheets("DimEmployee").Range("A1").AutoFilter(Field:=Globals.ThisWorkbook.Sheets("DimEmployee").Range("A1").ListObject.ListColumns.Item("FullName").Index, Criteria1:="Brian Welcker")

    2. The filter finds just one row

    3. I want to get the value of the field EmployeeKey of that row.

    What is the sintax I have to use for the Autofilter.Range ?

    Thank you.

    ciao


    joPol

    Friday, February 8, 2013 8:18 AM
  • Hi ciao,

    It's based on my experience that you need retrieve the rows of your listobject.Range via criteria and find out the correct row and access the field which you want.

    Have a good day,

    Tom 


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 11, 2013 7:12 AM
    Moderator