+ Reply to Thread
Results 1 to 12 of 12

Find matches, copy and paste adjacent cell

  1. #1
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Find matches, copy and paste adjacent cell

    Hi, i found this VBA from here https://support.microsoft.com/en-us/kb/213367

    Please Login or Register  to view this content.
    Find match in column F in column A
    This VBA only get result, what i want code that can copy from adjacent cell next to results.

    1.png

    2.png

    Book2.xlsx

  2. #2
    Forum Contributor
    Join Date
    05-27-2014
    Location
    Belfast, Northern Ireland
    MS-Off Ver
    2007 & 2010
    Posts
    273

    Re: Find matches, copy and paste adjacent cell

    Try replacing this line
    Please Login or Register  to view this content.
    with this line
    Please Login or Register  to view this content.
    Does that help?
    Please click *Add Reputation if I've helped

  3. #3
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find matches, copy and paste adjacent cell

    Please Login or Register  to view this content.
    多么想要告诉你 我好喜欢你

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Find matches, copy and paste adjacent cell

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Find matches, copy and paste adjacent cell

    Quote Originally Posted by kadeo View Post
    Try replacing this line
    Please Login or Register  to view this content.
    with this line
    Please Login or Register  to view this content.
    Does that help?
    errr.... doesnt work..

    Quote Originally Posted by millz View Post
    Please Login or Register  to view this content.
    Compile error: Next without for

    Quote Originally Posted by bakerman2 View Post
    Please Login or Register  to view this content.
    WORKING GREAT!!!
    THANK YOU!

    Btw, possible if run without selection first? Code will scan column till end and do "find match" and stop at last row

    Many thanks!

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Find matches, copy and paste adjacent cell

    If there are no empty rows between values then due to CurrentRegion code goes all the way to the end of both ranges.

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find matches, copy and paste adjacent cell

    Quote Originally Posted by amein View Post
    Compile error: Next without for :
    It means you replaced your code wrongly. The code fragment I posted did not consist of any For loops. You accidentally removed a Next statement.

  8. #8
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Find matches, copy and paste adjacent cell

    Quote Originally Posted by bakerman2 View Post
    If there are no empty rows between values then due to CurrentRegion code goes all the way to the end of both ranges.
    Hi again bakerman2,

    Just 1 last question... Is it possible if data come from different worksheet...

    How to modify the code so that will work between 2 different worksheet.

    thank you in advance..

  9. #9
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Find matches, copy and paste adjacent cell

    Quote Originally Posted by millz View Post
    it means you replaced your code wrongly. The code fragment i posted did not consist of any for loops. You accidentally removed a next statement.
    yeah thanks!!!!

    Now working

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Find matches, copy and paste adjacent cell

    How to modify the code so that will work between 2 different worksheet.
    Just put the relevant sheetnames in front of cells. f.i.
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    03-06-2014
    Location
    malaysia
    MS-Off Ver
    Excel 2003/2010/2013
    Posts
    107

    Re: Find matches, copy and paste adjacent cell

    Thank you so much for your help.

    Fyi, try to run with 20k row data.. With 11 column.. Macro running with no problem.
    Last edited by amein; 05-23-2016 at 10:57 AM.

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Find matches, copy and paste adjacent cell

    You're welcome.

+ 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: 3
    Last Post: 06-29-2015, 03:03 PM
  2. [SOLVED] Find matching data, copy data in adjacent cell and paste in new column
    By Bikeman in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-23-2015, 04:08 PM
  3. [SOLVED] Help with VBA Code - Find cells with specific value, Copy/Paste value from adjacent colmns
    By Mikeyc85 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-09-2015, 12:32 PM
  4. [SOLVED] Macro to find specific word in cell and then copy and paste the adjacent cell upwards
    By raytej82 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2014, 05:33 PM
  5. copy a specif cell value, find another like that in sheet copy adjacent cell and pate
    By smwaqas89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2013, 10:00 AM
  6. Replies: 0
    Last Post: 09-06-2012, 04:06 AM
  7. [SOLVED] find value, copy value of adjacent cell and paste it on another sheet
    By Ajgor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 04:21 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