+ Reply to Thread
Results 1 to 5 of 5

Need help in copy and pasting multiple lines based on a criteria

  1. #1
    Registered User
    Join Date
    12-26-2011
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    23

    Need help in copy and pasting multiple lines based on a criteria

    Hi all,


    I need an urgent help on a macro. I have very minimal experience with Macro and is struggling to get this done.

    I have a spreadsheet that has close 22K rows with a lot of data. The data is spread across various columns. The cell A1 is the unique id which repeats in various rows.

    Criteria Tab: The criteria using which the output needs to be generated. Unique ID (with duplicates removed)
    Data tab: The tab where the data is available. The columns where the data is available is on the top row
    Output tab: How I want the output to be.

    What I need is an output where all the same unique id details are copied and pasted in an order sorted A-Z based on the unique id. The unique id (after removing duplicates) will be in a separate tab within the sheet.

    I will have multiple tabs with the data I need to copy. The spreadsheet that I have attached has all the details.

    I hope I have explained it properly. If not, I am ready to give additional details.

    Thank you so much for your help.
    Attached Files Attached Files

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need help in copy and pasting multiple lines based on a criteria

    This might work but you might need to remove that rogue first row in the Data sheet:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    12-26-2011
    Location
    India
    MS-Off Ver
    Excel 2016
    Posts
    23

    Re: Need help in copy and pasting multiple lines based on a criteria

    WBD , Thank you for this macro. This worked like a charm.

    One quick question. Should the macro be changed drastically if I need to copy only certain columns? If yes, then this is fine.

    Thank you again for your help on this.

  4. #4
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Need help in copy and pasting multiple lines based on a criteria

    Not "too" drastic I would say - it depends which columns you want to keep and which ones you want to remove?

    WBD

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Need help in copy and pasting multiple lines based on a criteria

    xlbaby,

    Use of AdvancedFilter.

    Just copy the headings that you want to copy from Data to Output like attached.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jindon; 10-21-2021 at 04:30 AM.

+ 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. Remove lines based on multiple criteria
    By cmray58 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-20-2018, 12:12 PM
  2. Copy and pasting based on criteria
    By norseman1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-29-2016, 11:55 AM
  3. [SOLVED] Copy/Pasting data based on either/or criteria
    By jcroque89 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-18-2015, 02:18 PM
  4. VBA code not working for copy and pasting data based on criteria.
    By harkin123 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2013, 04:55 AM
  5. [SOLVED] Copy and Pasting Data in Columns Based on Criteria
    By forexcellence13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2013, 07:47 PM
  6. copy/pasting of values between sheets based on criteria
    By sunilmulay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2009, 10:49 PM
  7. Create multiple lines based upon criteria
    By SystemsAccountant in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-05-2008, 01:14 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