+ Reply to Thread
Results 1 to 15 of 15

Need Macro to Select All Files in a Column After Filter Applied

  1. #1
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Question Need Macro to Select All Files in a Column After Filter Applied

    I am recording a macro to filter some data and then select the data in the column after filtering. When I record it and select the data, it gives specific coordinates in the coding rather than selecting all visible rows after the filter.


    This is a problem because the filter will result in different rows each day, so the coordinates will not be the same as when I recorded it.

    Example: I filter a column to show anything containing values of {19,20,21,22,23,24}. Rows 2 and 3 do not fit this criteria, so they are removed...therefore when I select the column to copy (excluding the title row), it starts specifically with row 4.


    Please let me know if you need clarification on anything.

    The help is much appreciated.
    Last edited by Gard5096; 09-13-2012 at 02:57 PM.

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Macro to Select All Files in a Column After Filter Applied

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Need Macro to Select All Files in a Column After Filter Applied

    It is giving me an error for this part.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Macro to Select All Files in a Column After Filter Applied

    What is the name of the sheet you are copying it too? I just used "Destination" as an example.

  5. #5
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Need Macro to Select All Files in a Column After Filter Applied

    The name of the workbook is "Pipeline_Report" - Do I have to include the tab name as well? Would it be easier for you to just show me how to record this action so I can see where each variable is coming from?

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Macro to Select All Files in a Column After Filter Applied

    Yes. If you could provide the copy to Tab name. As far as I know, you can't record variables. However, it does sound like an easy fix I just need the tab name.

    Or you could change the code where I've put TAB NAME:

    Please Login or Register  to view this content.
    Last edited by JOHN H. DAVIS; 09-11-2012 at 01:43 PM.

  7. #7
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Need Macro to Select All Files in a Column After Filter Applied

    The tab name is "Report1" and the column that needs to be filtered is "L".

    Do I need to have my cursor on a certain cell when I run the macro?

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Macro to Select All Files in a Column After Filter Applied

    No, just run the macro, but make these changes first

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    09-11-2012
    Location
    Jacksonville fl
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need Macro to Select All Files in a Column After Filter Applied

    I do something similar. There is an select visible cells icon you can put on your Quick access toolbar. Right click on the quick access toolbar and select customize on the left. On your choose commands from section in the middle change it to all commands and slide down to "select visible cells:. Add it to quick access toolbar by hitting the add button. It will now show on the quick access toolbar. Run your macro and then hit the select visible cells and then copy them any where you want to.

  10. #10
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Need Macro to Select All Files in a Column After Filter Applied

    JOHN-

    When I run your code, first is hides all of the rows with data, and then the error occurs...if that helps
    Last edited by Gard5096; 09-12-2012 at 12:50 PM.

  11. #11
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Need Macro to Select All Files in a Column After Filter Applied

    Ohhhh JAYRUES, this works! Is there a way to do this, but having the title row removed?
    Last edited by Gard5096; 09-12-2012 at 12:42 PM.

  12. #12
    Registered User
    Join Date
    09-11-2012
    Location
    Jacksonville fl
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Need Macro to Select All Files in a Column After Filter Applied

    I'm afraid not not that i know of.

  13. #13
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Need Macro to Select All Files in a Column After Filter Applied

    JOHN - I used your code as a reference and figured out what I needed to do to make it work! Thank you very much for your time and expertise.

  14. #14
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need Macro to Select All Files in a Column After Filter Applied

    You're welcome. Glad you got a solution.

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Selecting all filtered files in a column when the row #s it selects are different each

    Hi Gard5096

    Try this
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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