+ Reply to Thread
Results 1 to 4 of 4

Macro Help - Match Copy & Paste

  1. #1
    Registered User
    Join Date
    02-03-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    8

    Macro Help - Match Copy & Paste

    Dear Friends,

    This seems to be very simple question but could not find any solution in other forums.

    Assume I have 1st WB with all data stored in sheet1 from A to H columns.
    Now lets say 2nd WB in sheet1 with only column A data.

    In 1st WB column E has values (not in order) incl duplicates and blanks few of them matching with column A in 2nd WB.

    Now my VB code should help me for each matching value starting from A1 in 2nd WB with E:E in 1st WB, it should copy the values of 3 adjacent columns (leaving one) to the left and paste it after the matched value in 2nd WB in Col B, C & D.

    Eg: If 2nd WB A1 matches with 1st WB E40 value then C40, B40 & A40 has to be copied to B1, C1 & D1 in 2nd WB. This should continue until the last value in the col A of 2nd WB.

    My code works 99% but instead copies F40, G40 & H40 to target columns. Below is my code but I was experimenting with some other similar test data having in the same workbook but different worksheets.

    Please Login or Register  to view this content.
    Note: Vlookup might not work here because there is huge lot of filtered data which cannot work in this case.
    Last edited by pike; 02-04-2011 at 12:29 AM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,486

    Re: Macro Help - Match Copy & Paste

    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.


    Keep it simple!
    Doing this will ensure you get the result you need!

  3. #3
    Registered User
    Join Date
    02-03-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro Help - Match Copy & Paste

    Quote Originally Posted by davesexcel View Post
    To best describe or illustrate your problem you would be better off attaching a dummy workbook, the workbook should contain the same structure and some dummy data of the same type as the type you have in your real workbook - so, if a cell contains numbers & letters in this format abc-123 then that should be reflected in the dummy workbook.

    If needed supply a before and after sheet in the workbook so the person helping you can see what you are trying to achieve.


    Keep it simple!
    Doing this will ensure you get the result you need!
    Yes here it is.. thanks by the way
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    02-03-2011
    Location
    Bangalore
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Macro Help - Match Copy & Paste

    This code works for right columns, but i want for left columns data

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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