+ Reply to Thread
Results 1 to 2 of 2

Copy Data from current sheet with Auto Filter/Looping then paste to another sheet

  1. #1
    Registered User
    Join Date
    07-06-2019
    Location
    Hong Kong
    MS-Off Ver
    MS Office 365
    Posts
    6

    Copy Data from current sheet with Auto Filter/Looping then paste to another sheet

    I am a starter of Excel VBA (with no programming experience / background), trying to learn to use auto filter and looping to copy data from one sheet to another sheet.

    1) Please help out on error handling issue when auto filter returns no data.
    - Kindly try to modify the code in Module 1 with step by step comments. (if possible)
    - the existing codes only works when auto filter returns sorted data. In the attached sample, there is no HKD invoice records and the result is a mess.
    - In the desired result sheet, I also want to know how to achieve the result in the "GRAND TOTAL" row.

    2) I also want to know more about the looping logic with this example.
    - I only know the very simple logic with one variable at the moment. I think I need to add another variable but I don't know how to work with the logic.
    - Please help to modify the code in Module 2 with step by step comments. (if possible)

    Thanks in advance !
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Copy Data from current sheet with Auto Filter/Looping then paste to another sheet


    Hi,

    first operate manually a so easy Excel Basics 2 steps without any bad looping logic :
    sort your data on column C then use the Data SubTotal feature …
    Once it works as expected, if you really need a VBA code,
    restart and just before to operate activate the Macro Recorder
    in order to get your own base code, so easy, just try ! …

+ 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. [SOLVED] VB Code to filter data and copy paste in another sheet
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-06-2020, 11:43 PM
  2. Vba code for auto filter, copy, paste and save to new sheet
    By Hanky in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-22-2018, 07:19 AM
  3. Filter copy paste data based on sheet name
    By kannan1847 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-31-2015, 01:58 PM
  4. [SOLVED] VBA - Macro issue copy/paste line other sheet + duplicate current sheet
    By vcourbiere in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-17-2014, 12:06 PM
  5. VBA Code to filter,Copy and Paste data from one sheet to the other
    By aravindkm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-18-2013, 03:39 PM
  6. Looping through worksheets to copy/paste to new sheet - last sheet never copies
    By lifeboat in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-10-2011, 01:53 PM
  7. how to filter and copy data from one sheet and paste to new worksheet
    By mr_asrul in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-03-2008, 07: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