+ Reply to Thread
Results 1 to 4 of 4

Help on filter function using VBA

  1. #1
    Registered User
    Join Date
    10-13-2013
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Help on filter function using VBA

    Hi all,

    I wrote a macro coding to filter data from active sheet from specific companies by company ID that I inputted in the other sheet named "ID". The company ID only contains list of numbers. When I run the macros, it filtered out all the values even though some of the ID that I inputted in the sheet named "ID" present in the data. Below is my coding;

    Sub FilterID()
    Dim vCrit As Variant
    Dim wsD As Worksheet
    Dim wsC As Worksheet
    Dim rngCrit As Range
    Dim rngData As Range


    Set wsD = ActiveSheet
    Set wsC = Worksheets("ID")
    Set rngData = wsD.Range("$A$1:$XFD$1048576")
    Set rngCrit = wsC.Range("$A$1:$A$283")


    vCrit = rngCrit.Value


    rngData.AutoFilter _
    Field:=3, _
    Criteria1:=Application.Transpose(vCrit), _
    Operator:=xlFilterValues


    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Help on filter function using VBA

    difficult to test without even a small extract of data (you can post file in this newsgroup).

    not clear why transpose in criteria1.

    can you give atleast one vcrit.
    I am not an expert. better solutions may be available
    [email protected]

  3. #3
    Registered User
    Join Date
    10-13-2013
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Help on filter function using VBA

    Hi,

    Attached is the sample data.
    Thank you in advance for your help.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-13-2013
    Location
    Kuala Lumpur, Malaysia
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Help on filter function using VBA

    Hi venkat,

    I have posted the sample data.
    Thank you in advance for your help.

+ 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. Filter function help
    By Lemming911 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-09-2013, 05:16 AM
  2. Filter by Function
    By arctushar in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-29-2013, 04:29 AM
  3. Help with the filter function.
    By justifiedcandy in forum Excel General
    Replies: 6
    Last Post: 08-19-2010, 02:04 PM
  4. Filter function
    By Brian Brandt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 04-26-2006, 07:59 AM
  5. advanced filter a range:Advanced Filter function
    By Il Principe in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM

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