+ Reply to Thread
Results 1 to 9 of 9

Is possible pass array to function Filter mach parameter?

  1. #1
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Is possible pass array to function Filter mach parameter?

    Hi

    I try read range from column in activesheet to a VBA Array
    Filter this array to parameter Match like Not equal array into Filter fucntion.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    What is wrong? I'm confused

    Thnks
    "No xadrez nem sempre a menor dist?ncia entre dois pontos ? uma linha reta" G. Kasparov.

    If your problem is solved, please say so clearly, and mark your thread as Solved: Click the Edit button on your first post in the thread, Click Go Advanced, select b from the Prefix dropdown, then click Save Changes. If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Is possible pass array to function Filter mach parameter?

    The 2nd argument needs to be a string, not an array. You will need to loop through the array
    Please Login or Register  to view this content.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,704

    Re: Is possible pass array to function Filter mach parameter?

    removed - dupe of fluff

  4. #4
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Is possible pass array to function Filter mach parameter?

    Fluff there's no error anymore but the result is wrong
    I have a column CFOP
    CFOP
    '5103
    '6103
    '6103
    '6103
    '5103
    2204
    '5402
    '5402
    '5402
    '5402
    '5402
    '5103
    '5103
    '5103
    '5103
    '5103

    I would like this result
    CFOP
    '6103
    '6103
    '6103
    2204

    The code gives me this
    5103
    5402

    Why this code bring me inver result?

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Is possible pass array to function Filter mach parameter?

    With those values i get
    6103
    6103
    6103
    2204

    Which is what you want.
    What code are you using?

  6. #6
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Is possible pass array to function Filter mach parameter?

    This one
    Please Login or Register  to view this content.
    Maybe it's because apostrophe in front of the number
    '5102
    '2102


    Thanks
    Last edited by marreco; 04-29-2020 at 11:55 AM.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Is possible pass array to function Filter mach parameter?

    Not sure how you got the results you posted with the data shown, as I get
    6103
    6103

    Which is exactly what I would expect. You are just printing the first value in arrCFOP, both times trough the loop.
    You need to loop through the array after filtering it to get the full results.

  8. #8
    Valued Forum Contributor marreco's Avatar
    Join Date
    07-02-2011
    Location
    Brazil
    MS-Off Ver
    Excel 2010
    Posts
    1,862

    Re: Is possible pass array to function Filter mach parameter?

    Thank you!!
    Please Login or Register  to view this content.

  9. #9
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,077

    Re: Is possible pass array to function Filter mach parameter?

    You're welcome & thanks for the feedback.

+ 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. [SOLVED] How to pass on a Variable Parameter to a Function
    By dhatul in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2015, 01:51 PM
  2. Replies: 2
    Last Post: 10-06-2014, 08:15 AM
  3. Replies: 0
    Last Post: 10-06-2014, 07:35 AM
  4. SOS-How to pass array parameter to Workbooks.OpenText(...) in VC++
    By Lily in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-17-2010, 04:28 AM
  5. Read Range To Array, Then Pass Array To Function
    By ProbablyNotARealName in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-20-2010, 12:29 PM
  6. [SOLVED] Pass Cell Contents To Array And Filter
    By jaslake in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-09-2010, 03:08 PM
  7. [SOLVED] Excel2000: Declaring function parameter as an array
    By Arvi Laanemets in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-25-2005, 09:06 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