+ Reply to Thread
Results 1 to 9 of 9

Autofilter _ cannot assing criteria to array

  1. #1
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Autofilter _ cannot assing criteria to array

    Hi, I'd need to loop through criteria in filtered field.
    Please Login or Register  to view this content.
    When I assign multiple criteria to dynamic array, I get Type MisMatch.
    When I switch to ordinary Variant ( Dim vCriteria as Variant ),
    I store only the first selected Criteria.

    Can somebody advise what I miss here please?

  2. #2
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Re: Autofilter _ cannot assing criteria to array

    Strange is that when I have 3 and more criteria checked, it works. For less than 3 it doesn't.

  3. #3
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Re: Autofilter _ cannot assing criteria to array

    Any ideas? I still haven't figured that out.
    I appreciate any response.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Autofilter _ cannot assing criteria to array

    When you filter data, you get visible cells. These cells are areas, not regions. Let say, rows 1 and 3 are visible, but row 2 is hidden, so when you load the data in to an array, you get areas 1, which is only 1 row, not all visible rows. Row 3 will be areas 2 and so on.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Autofilter _ cannot assing criteria to array

    Hi,

    For 2 criteria you have values in Criteria1 and Criteria2. For more than 2 there will be an array stored in Criteria1 alone.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Re: Autofilter _ cannot assing criteria to array

    Thank you both!
    And xlnitwit, you are completely right! That's what I was looking for.
    One last, is there other way of counting how many criteria were selected than assigning array and counting its items?

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Autofilter _ cannot assing criteria to array

    If you are using array as a criteria, the array should have count number. Any array has dimensions.

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Autofilter _ cannot assing criteria to array

    I'd need to loop through criteria in filtered field.
    is nothing to do with criteria in filter function.

    You have already applied your criteria and got your filtered visible rows.
    That is how I understood your question anyway.
    Now, you are talking about the number of criteria- could only be 2 or an array criteria
    Last edited by AB33; 08-13-2016 at 07:30 AM.

  9. #9
    Registered User
    Join Date
    05-30-2015
    Location
    SVK
    MS-Off Ver
    2016
    Posts
    38

    Re: Autofilter _ cannot assing criteria to array

    Thanks AB33, both information are useful.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. AutoFilter Get Criteria Array
    By alexbeatle in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-13-2014, 09:45 AM
  2. Autofilter Array Criteria
    By weeeee0713 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2014, 03:45 AM
  3. Using an array as criteria in an AutoFilter
    By brucemc777 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-28-2014, 10:15 AM
  4. [SOLVED] AutoFilter: Array as Criteria
    By Klaster in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-10-2014, 06:36 PM
  5. [SOLVED] Using an array from a range for Autofilter Criteria
    By J-Tin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-31-2013, 10:49 AM
  6. AutoFilter Multiple Criteria Array
    By erock24 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-02-2013, 04:33 AM

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