+ Reply to Thread
Results 1 to 10 of 10

Macro & filters

  1. #1
    Registered User
    Join Date
    04-29-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    42

    Macro & filters

    Hi All,

    I'm trying to create a simple macro that will in essence will filter by a specific name and then copy that data into a new tab. From previous experience writing MACROs like this I encounter the problem that if what I want it to filter by isn't on the least it will return a debug instead of moving onto the next one. EG: Data holds Months, however month data for July is missing so I want it to look for the filter it's not there so it then tries, August for example.

    My Macro knowledge is very basic so any guidance would be appreciated.

    Hope this makes sense?

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro & filters

    You gave very vague detail with no specifics. Impossilbe to accurately answer your question without guessing on 90% of it.

  3. #3
    Registered User
    Join Date
    04-29-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Macro & filters

    Wasn't sure if there was just something I could add to the end of the Macro after detailing what to filter on to say if not there move to next one, Hence not putting a great detail of information. Full details below:

    Card Number First Name Surname Transaction Date Posting Date Merchant Name Merchant City Transaction Amount Foreign Currency Foreign Currency Amt Foreign Currency Rate


    Above is the columns heading I have. I want to be filtering by Surname, taking the data from "Trans Date", "Merchant Name" "Transaction Amount" and pasting this into a tab which is already set up with the persons name.

    I will have for example 20 tabs with names on, however these may not always appear in the data.

    Does this help?

  4. #4
    Registered User
    Join Date
    04-29-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Macro & filters

    Please Login or Register  to view this content.
    Above is example of what I have. As I say I'm very basic with Macros.
    Last edited by Toxicca; 10-01-2014 at 02:25 PM.

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro & filters

    I think I know what you are wanting to do and it shouldn't be too complicated. Could you by chance submit an example workbook with a little bit of data, fake data would be best, for me to test the code on. Please make sure it mimics as close as possible to your real sheet.

  6. #6
    Registered User
    Join Date
    04-29-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Macro & filters

    Hi I have attached a sample sheet.

    The tab's labelled, Cat, Dog, Fish, Rabbit are what I want to filter Data 3 (c) with and if not in data to move onto the next one.

    I want it to copy data from the columns in Yellow so Data 4, Data 6 & Data 8.

    Many Thanks
    Attached Files Attached Files

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,815

    Re: Macro & filters

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  8. #8
    Registered User
    Join Date
    04-29-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Macro & filters

    Sorry was unaware. Not used this forum that often. Have amended

  9. #9
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro & filters

    give this a try:

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-29-2013
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    42

    Re: Macro & filters

    That works perfectly.

    I need to make a slight change to where the data is copied to. eg I would like Data 4 to be moved into cells B3 and down, Data 6 in C3 and down, and finally Data 8 to go into Cell N3 and down.

    Sorry to be a pain.

+ 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: 7
    Last Post: 07-15-2019, 03:06 AM
  2. Using filters, and then unselecting filters. Organizing data.
    By lesoies in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 08-09-2013, 07:55 AM
  3. Replies: 4
    Last Post: 07-24-2012, 01:21 PM
  4. Macro with Filters
    By Alwaysmiling in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 02-22-2011, 06:43 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