+ Reply to Thread
Results 1 to 12 of 12

Filter Workbook1 column A with a list on Workbook2 column A (In the background preferably)

  1. #1
    Registered User
    Join Date
    04-03-2023
    Location
    america
    MS-Off Ver
    365
    Posts
    11

    Filter Workbook1 column A with a list on Workbook2 column A (In the background preferably)

    Workbook1 column A is a list of hundreds of building numbers. I only need certain buildings at a given time not all of them. Workbook2 (column A) is a template sheet that has a list of building numbers that is constantly being updated or changing. I need to filter column A in workbook1 by a list that shows up on column A in Workbook2. I currently have it running in the VBA Code where I had to enter each specific building number "building 1", "building 2", ...., Etc. Problem is the list of building numbers changes from time to time so I can't keep going into the VBA code and editing the building numbers individually I would rather Call a master list that is updated to be the driving force behind the filter.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,953

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.

    In this case, both files.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    04-03-2023
    Location
    america
    MS-Off Ver
    365
    Posts
    11

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    DataSet.xlsxUpdatedSheet.xlsx

    DataSet is building numbers and Updated sheet workbook is the other workbook. I don't have the VBA code for it because I've been filtering the individual sheet using record macro.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,888

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    It would help if you could attach both workbooks and let us know in which workbook you want to place the macro.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    Registered User
    Join Date
    04-03-2023
    Location
    america
    MS-Off Ver
    365
    Posts
    11

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    I attached them in a separate comment cause someone else said the same thing. The macro/filter should be applied to the Dataset workbook and then the UpdateSheet is the criteria for the filter (needs to be two separate workbooks because one sheet is a template and the other sheet is a list of buildings that is constantly being update.

  6. #6
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    Quote Originally Posted by bino1121 View Post
    I attached them in a separate comment cause someone else said the same thing. The macro/filter should be applied to the Dataset workbook and then the UpdateSheet is the criteria for the filter (needs to be two separate workbooks because one sheet is a template and the other sheet is a list of buildings that is constantly being update.
    Hi bino. The following model:
    Example_1.xlsm
    \_______________________________/

    apply an advanced filter between two sheets of the same workbook (I did it this way because you didn't upload anything useful to the Forum).

    But you will see that to adapt it to your needs you just have to change:

    - Workbook objects,
    - Worksheet objects, and
    - The respective cell ranges.

    I suggest you try to adapt this to what you have and then comment:

    PHP Code: 
    Sub Macro8()
    Dim criteria_Range As Range
    Rem 
    -------------------------------->
    Set criteria_Range ActiveWorkbook.Sheets("Sheet2").Cells(1).CurrentRegion.Columns(1)
    Rem -------------------------------->
    With ActiveWorkbook.Sheets("Sheet1")
      .
    Cells(1).AutoFilter
      
    .Cells(1).CurrentRegion.AdvancedFilter 1criteria_Range, Empty, False
    End With
    Rem 
    -------------------------------->
    End Sub 
    You are always very welcome if you add reputation by clicking the * (bottom left) of each message that has helped you.

  7. #7
    Registered User
    Join Date
    04-03-2023
    Location
    america
    MS-Off Ver
    365
    Posts
    11

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    Ok so here is the code I'm using so far to use advanced filter.... How do I change it so the range is control + shift+ down so the macro always selects everything in that column even if the column size is +- 12737?? If the code looks a little odd that's because it was a picture that I used copy and paste from Iphone so overall there's no errors in the actual code in VBA I just need to know how to implement the range as control + shift + Down in the existing code.

    Sub Filter_Test ()

    Range ("A3 :Al2737") .AdvancedFilter Action: =xlFilterInPlace, CriteriaRange:= _

    Sheets ("FACILITIES"). Range ("Al:A97"), Unique:=False

    End Sub
    Last edited by bino1121; 04-05-2023 at 09:28 AM.

  8. #8
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    PHP Code: 
    Sub Filter_Test()
    Range("A3"Range("A3").End(xlDown)).AdvancedFilter Action:=xlFilterInPlace_
      CriteriaRange
    :=Sheets("FACILITIES").Range("Al:A97"), Unique:=False
    End Sub 

  9. #9
    Registered User
    Join Date
    04-03-2023
    Location
    america
    MS-Off Ver
    365
    Posts
    11

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    How would this work with the range being the same for the facilities sheet?? I tried doing it the same way as the "A3" one you did above and it didn't work.

  10. #10
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    Quote Originally Posted by bino1121 View Post
    How would this work with the range being the same for the facilities sheet?? I tried doing it the same way as the "A3" one you did above and it didn't work.
    This VBA code is designed to work on the active sheet: did you adapt the code to work on that other sheet?...

  11. #11
    Registered User
    Join Date
    04-03-2023
    Location
    america
    MS-Off Ver
    365
    Posts
    11

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    Yea so I changed the range from your code (A1:A97) I need that range to also be Control shift down instead of that set range. The first part of the code runs good it selects the correct column from the first page as its supposed to. I just need both ranges to be a variable size range as opposed to a defined value of ranges.

  12. #12
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: Filter Workbook1 column A with a list on Workbook2 column A (In the background prefera

    Look at post #6.

+ 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. Replies: 0
    Last Post: 10-29-2022, 04:40 PM
  2. Replies: 3
    Last Post: 06-19-2016, 09:34 AM
  3. How to bring data from workbook1 to workbook2 by comparing values of workbook2
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-04-2013, 09:38 AM
  4. Workbook1 should start Workbook2
    By KausBorealis in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2012, 10:52 PM
  5. Move tab from Workbook1 to Workbook2 using Macro VBA
    By nachousa in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-08-2010, 11:58 AM
  6. Data from workbook1 to workbook2 every week but in different place in workbook2
    By cheelie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-29-2007, 06:26 PM
  7. Replies: 1
    Last Post: 05-18-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