+ Reply to Thread
Results 1 to 6 of 6

Macro to identify a unique value in a column to copy and paste value to another sheet

  1. #1
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Macro to identify a unique value in a column to copy and paste value to another sheet

    I would need help in building a macro for the attached example.

    There are multiple columns on Sheet 1. I need the macro to identify, if a specific row in column D contains "ABC" then the information in that row should be pasted in sheet 2

    In the example sheet, Column D has the unique ID. So as D4 contains "ABC", A4 should be pasted in H3, D4 to I3 and E4 to J3. Then the macro to automatically check the next row to indentify if it contains "ABC".

    IF not, move to the next row.

    In this case, the next row that has ABC is D6. So as D6 contains "ABC", A6 should be pasted on the next line in Sheet 2 i.e. H4, D6 to I4 and E6 to J4.

    I hope I was able to put it right in words..


    Attachment 148703
    Thanks,

    Bonny Tycoon


  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to identify a unique value in a column to copy and paste value to another sheet

    hi bonny24tycoon, please check attachment, press "Run"
    Attached Files Attached Files

  3. #3
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: Macro to identify a unique value in a column to copy and paste value to another sheet

    Hi Watersev,

    It did work.. HOwever, that was a example sheet and on my real workbook there are many more columns. As in the example, column A, D & E will be copied, how, can I change which columns needs to be pasted to which column in the new sheet??
    Last edited by bonny24tycoon; 04-04-2012 at 06:58 AM.

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Macro to identify a unique value in a column to copy and paste value to another sheet

    Please Login or Register  to view this content.
    where

    .Resize(, 1) - column A or the first column of the used range
    .Offset(, 3).Resize(, 2) - column A or the first column of the used range offsetted 3 columns to the right - column D and resized to 2 columns - Columns D and E

  5. #5
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: Macro to identify a unique value in a column to copy and paste value to another sheet

    Hi Watersev,

    Thanks for the explanation.. I tried but it seems im not entering the correct combinations.

    I need the below columns to be copied

    ColumnA
    ColumnC
    ColumnE
    ColumnH
    ColumnJ
    ColumnM
    ColumnT

    Can you help??

  6. #6
    Forum Contributor bonny24tycoon's Avatar
    Join Date
    04-02-2012
    Location
    Hell
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    405

    Re: Macro to identify a unique value in a column to copy and paste value to another sheet

    Hi watersev,

    I got the combination at last..

    It is

    Please Login or Register  to view this content.
    Thanks alot for your help..

    For me as a beginner I really appreciate your help and you really deserve a reputation... :-)
    Last edited by bonny24tycoon; 04-04-2012 at 08:04 AM.

+ 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