+ Reply to Thread
Results 1 to 6 of 6

Advanced Filter based on variable.

  1. #1
    Registered User
    Join Date
    06-04-2007
    Posts
    61

    Advanced Filter based on variable.

    Please Login or Register  to view this content.
    I am trying to find all the unique values within a column, passed from another routine so that I can then count the number of unique items, autofilter based on the value of each unique item, and then some manipulations with the autofiltered data.

    I have everything else working but this advanced filter based on a variable. The variable passed in is a column reference, if you haven't guessed (CharacteristicField). When trying to execute this section of the code, I get a 1004 error.

    Any help would be great in completing this last step.

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    Try commenting out this portion:
    Please Login or Register  to view this content.
    or changing it to:
    Please Login or Register  to view this content.
    Also, are you sure you want it to filter starting in row 2? This means row 2 contains the header for your list. Just checking.

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Is CharacteristicField > 0 ? LastRow?

  4. #4
    Registered User
    Join Date
    06-04-2007
    Posts
    61
    Ikaabod - This does not help - it still errors out.

    mikerickson - Yes, CharacteristicField is > 0, I have also tried hard coding it as a 1 with no luck

    When I record the process I am trying to do, I get the following:
    Please Login or Register  to view this content.
    When I replace the defined range with any type of variables as below, it errors out. Short of using a case statement, how should I be doing this?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Where is this code? If it is in a Sheet, ThisWorkbook or Userform code module, try moving it to a normal module.

    Also, if you fully qualify it that might help.

  6. #6
    Registered User
    Join Date
    06-04-2007
    Posts
    61
    I am trying to convert the following into an advanced filter function to save time and do everything in one step. I can this manually, so I know it can be done, but when I convert the set range to variables, it errors out.

    I hope this explains more to what I am trying to do.

    Please Login or Register  to view this content.
    When I record the process I am trying to do, I get the following:

    Please Login or Register  to view this content.
    When I replace the defined range with any type of variables as below, it errors out. Short of using a case statement, how should I be doing this?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1