Consulting

Results 1 to 6 of 6

Thread: Filter for a list of values

  1. #1
    VBAX Regular
    Joined
    Jul 2006
    Posts
    14
    Location

    Filter for a list of values

    Hello all, I hate to ask a question on a first post, but that appears to be what this forum is for.

    I have a schedule in Excel that I have to keep up. Each item has a unique number associated with it. Each day, I get in an Excel sheet, a list of changes which can range anywhere from one line to hundreds of lines. For changes, the change list includes the unique numbers. I'd like to be able to filter for the numbers in the new sheet, so I can easily remove them and insert the changes, but I cant figure out any way to do this. I can't post the actual files, but for example, lets say my schedule contains 100 items numbered 1-100. The change file has changes listed to lines 22, 37, 53, 62, 73. How can I filter the main list to only show the same line numbers as the change file? Is there an easy way to do this I am overlooking? Thanks in advance.

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    It would be much better to have the VBA code find each Change item for you and replace the data. All you would need to do is click the button.
    Does the change list have the same name all the time?

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Oharris,
    Welcome to VBAX
    I think you're in luck. I just made up something very similar here. The code can be easily adapted to read in a list on numbers from the spreadsheet to replace the AT and CRN values as coded.
    http://vbaexpress.com/forum/showthread.php?t=8832
    If you need assistance, let us know.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Here's one that uses advanced filter to filter by selections you choose(enter them in col L) and copies them to another sheet for comparison. Maybe you can get it to work for what your doing.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Column L works better if you use this:
    [VBA]
    Range("A4:K30").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
    [L1], [L1].End(xlDown)), CopyToRange:=Range("Print!A3"), Unique:=False
    [/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  6. #6
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    By putting your criteria range on another sheet or in a userform/messagebox you can use Action:=xlFilterInPlace to filter in place
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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