+ Reply to Thread
Results 1 to 16 of 16

Copying data to a new sheet to run advanced filter

  1. #1
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Copying data to a new sheet to run advanced filter

    Hello All,

    I'm attempting to take input data from one data sheet ('ACT_MEM' Sheet) to ('WEAPS_RPT_DATA' Sheet) so I can run an Advanced Filter. The idea is to have a readable table of data available for printing or viewing. The 'ACT_MEM' Sheet contains data that is entered from two separate worksheets.

    I've been able to copy the correct columns of data from 'ACT_MEM' Sheet to the 'WEAPS_RPT_DATA' Sheet. But I would like to speed up the process with better coding, which is beyond my understanding. Or could I run an Advanced Filter directly from the 'ACT_MEM' Sheet to the 'WEAPS_RPT_DATA' Sheet? I have attempted to without success.

    Thank you in advance for your time to look at my question and issue.

    V/r,
    Jim
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copying data to a new sheet to run advanced filter

    Jim

    What data do you want to copy from 'ACT_MBR' and how do you want to filter it?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    Norie,

    I want the data from 'ACT_MBR' going to 'WEAPS_RPT_DATA' Sheet in the order of columns "A:AR". Then I use an Advanced Filter to take the data to 'WEAPS_QUAL_RPTS' Sheet filtered and sorted.
    -- The data is entered onto 'ACT_MBR' form two sperate DATA entry worksheets ('CREW_INFO' and 'WEAPS_QUALS') and each data Entry worksheet uses a portion of each others copied data.

    I made an error in my question above:

    I've been able to copy the correct columns of data from 'ACT_MEM' Sheet to the 'WEAPS_RPT_DATA' Sheet. But I would like to speed up the process with better coding, which is beyond my understanding. Or could I run an Advanced Filter directly from the 'ACT_MEM' Sheet to the 'WEAPS_RPT_DATA' Sheet? I have attempted to without success.
    I should have asked:

    **Or could I run an Advanced Filter directly from the 'ACT_MEM' Sheet to the 'WEAPS_QUAL_RPTS' Sheet?

    V/r,

    Jim

  4. #4
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    Hi,

    I found a string that seems to be lighter and easier to use (I'm guessing).
    https://www.mrexcel.com/forum/excel-...-vba-code.html

    I tried to take the a few columns from my extraction data 'ACT_MBR' and paste to the 'WEAPS_RPT_DATA' sheet. I get a Compile error: Expected Array on the

    Please Login or Register  to view this content.
    portion of the code.

    Please Login or Register  to view this content.
    Does this method have any merit toward my goals? I am very weak in VBA coding and have been trying to understand it better.

    Again, Thank you for your thoughts and time.

    V/r,
    Jim

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copying data to a new sheet to run advanced filter

    Jim

    So in the workbook you attached A3:AR16 would be copied from 'ACT_MBR' to 'WEAPS_RPT_DATA'?

    How is that data then filtered/sorted?

    As for the code in post #4, the problem is with the declaration of myColumns.

    myColumns should be declared as Variant, not string.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    Norie,

    Yes that would be correct. The Data residing on 'ACT_MBR' is much more than required for the 'WEAPS_RPT_DATA'. So with that copied data on 'WEAPS_RPT_DATA' sheet I run an Advanced Filter to place the finished data on the 'WEAPS_QUAL_RPTS' Sheet. There its clean and available review, printing and using basic On Sheet Filtering for a user. Or at least that's the idea.

    I'm thinking I should reformat the how the data gets saved on the 'ACT_MBR' Sheet so it can easily be sent to the 'WEAPS_RPT_DATA' Sheet. Since It takes a lot of time to copy and move the data over which most if it already formatted the correct way.

    Anyway Thank you for taking a look at my code. I adjusted the code in post #4 and the data did not copy and paste over to the correct sheet. Maybe I have it not properly set the paste location or something.


    V/r,
    Jim

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Copying data to a new sheet to run advanced filter

    Jim

    Are you actually filtering the data based on some criteria or is it that you only want certain columns to be copied?

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Copying data to a new sheet to run advanced filter

    Give this a go. Push button on 'WEAPS_RPT_DATA' Sheet.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by bakerman2; 05-17-2019 at 08:25 AM. Reason: Added code
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  9. #9
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    Norie,

    I was only going to copy the data and then run filters (as needed) for the 'WEAPS_QUAL_RPTS' when a user is accessing that Sheet. I don't think it necessary to filter the copied data yet.


    V/r,
    Jim

  10. #10
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    bakerman2,

    Wow, that code is very quick. My initial though is that it works for what I'm looking to do in this part of the project. It's very late here and I need to rest. I will do more testing. How could I run this code say upon Log-In? I intend to add that feature as well. I guess I'm asking where best to place it. My thought is if data has changed and that sheet does not auto up-date. Thank you for your input.

    This project is been very long in creating and am close to finishing. Again, Thank you.
    V/r,
    Jim

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Copying data to a new sheet to run advanced filter

    Maybe the Worksheet_Activate-event from 'WEAPS_RPT_DATA' Sheet.

  12. #12
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    bakerman2,

    Thank you for your reply. I was going to hide that sheet along with a couple others. I intend on using the sheets holding the tables as the "backend" for a multi-user application, well that is what I hope to do.

    V/r,
    Jim

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Copying data to a new sheet to run advanced filter

    Then maybe on the Worksheet_Deactivate of 'ACT_MBR' sheet.

    It all just depends on how you are planning to use the file (sequence of actions taken)

  14. #14
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    bakerman2,

    Thank you for your reply. I was going to hide that sheet along with a couple others. I intend on using the sheets holding the tables as the "backend" for a multi-user application, well that is what I hope to do.

    V/r,
    Jim

  15. #15
    Forum Contributor sorensjp's Avatar
    Join Date
    12-23-2015
    Location
    Yokosuka, JP
    MS-Off Ver
    2007 and 2016
    Posts
    196

    Re: Copying data to a new sheet to run advanced filter

    bakerman2,

    Thank you for the code. Ultimately, it does exactly what I needed. I will apply it in a couple different areas with-in the project. Also I decided I could just restructure where the data is saved in the on the 'ACT_MBR' Sheet.

    Again, Thank you.

    Norie,

    Thankyou for asking me how and what I intend on doing with the data. I made me re-think how I set up the 'ACT_MBR'.

    V/r,
    Jim

  16. #16
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Copying data to a new sheet to run advanced filter

    You're welcome and thanks for rep+.

    Good luck with your project and you know where to find us incase you need some more assistance.

+ 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. VBA Advanced Filter - Two Filters Without Deleting Bottom Filter Data In Same Column Range
    By hysterical.useless in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-14-2017, 02:54 PM
  2. [SOLVED] Filter and copying data to new sheet
    By oeyandyprawira in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-28-2015, 09:19 AM
  3. [SOLVED] Advanced Filter - extracting data to new sheet based on date
    By Martin 1088 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-30-2014, 11:24 AM
  4. [SOLVED] Advanced Filter - extract data to new sheet
    By schnautza in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-28-2014, 02:43 PM
  5. Advanced Filter Not Copying All of the Data to a new location
    By savyfhgal in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-21-2013, 09:35 AM
  6. advanced filter - button to re apply advanced filter across multiple sheets
    By motmac87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2013, 11:16 PM
  7. Replies: 2
    Last Post: 06-09-2010, 09:15 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