+ Reply to Thread
Results 1 to 4 of 4

If cell value on Sheet1 not found on Sheet2 copy row to Sheet2

  1. #1
    Registered User
    Join Date
    06-03-2013
    Location
    Surrey
    MS-Off Ver
    Excel 2010
    Posts
    6

    If cell value on Sheet1 not found on Sheet2 copy row to Sheet2

    Hi

    I'm very new to writing Macros and VBA so wondering if anybody can help.

    I have attached a sample workbook.

    I am trying to write a macro that if a cell in column A on Sheet1 is clicked a search is performed for the value in column D to see if it already resides in column A on Sheet2. If it does then a message box is displayed else some of the row cotents is copied to over to Sheet2 (the columns don't match like for like).

    Here is my simple code so far:
    On Sheet1:
    Please Login or Register  to view this content.
    In Module 1:
    Please Login or Register  to view this content.
    I've searched for simlar problems and can't figure out how to stop using set cells/ranges and make it look at the clicked row. Also how to append each new copied row under the previous one on Sheet2.

    Any help appreciated.

    Yxx
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor tehneXus's Avatar
    Join Date
    04-12-2013
    Location
    Hamburg, Germany
    MS-Off Ver
    Work: MS-Office 2010 32bit @ Win8 32bit / Home: MS-Office 2016 32bit @ Win10 64bit
    Posts
    944

    Re: If cell value on Sheet1 not found on Sheet2 copy row to Sheet2

    Hi,

    this will allow you to select as many cells in column A as you like and each will be checked:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please use [CODE]-TAGS
    When your problem is solved mark the thread SOLVED
    If an answer has helped you please click to give reputation
    Read the FORUM RULES

  3. #3
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: If cell value on Sheet1 not found on Sheet2 copy row to Sheet2

    Hi
    Please find herewith the solution (I hope ).
    Let me know if you need further help.
    Good luck.
    Tony
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    06-03-2013
    Location
    Surrey
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: If cell value on Sheet1 not found on Sheet2 copy row to Sheet2

    Thanks both so much for your help.

    tehneXus - yours does exactly whant I want, an array never crossed my mind to research into. I'll do it now to aid understanding your solution.

    ARGK - thanks for your solution. It does all but put the copied issue to the end of the existing list on sheet2. My orignal workbook has 2000 rows and growing with each event we run.

    Yxx

+ 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