+ Reply to Thread
Results 1 to 6 of 6

Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    3

    Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

    Hi All,

    I am new to Excel Macros and need experts Help, I was stuck up at Compare and copy data from one sheet to another sheet in Excel 2007.

    I have a excel workbook which contains 3 sheets(sheet1 , sheet2 and sheet3). Sheet1 is master sheet of sheet2 and sheet3 means it will get data from these 2 sheets, so sheet1 columns are combination of sheet2 & sheet3 columns.

    sheet2 & sheet3 are linked with different external sources and when ever changes will occur in external sources automatically these two sheets will get updated . so always these sheets are having latest data .

    but sheet1 is getting data from sheet2 and sheet3, sheet1 is not updating every time when sheet3 got update ,since we are not automated the connection between sheet1 and sheet3.

    our objective of this Macro is , it should compare the sheet1 and sheet3 based on Request Number(it is a unique and common column in both sheets) and needs to copy the whole row corresponding to the request number from sheet3 which does not exists in sheet1 and paste the data into corresponding columns in sheet1. we need to make sure that no duplicate values are occurred in Request Number in sheet1.( example sheet1 have 10 rows and sheet3 have 13 rows, in both sheets 10 rows are identical and remaining 3 rows added newly in sheet3. now we need to copy those 3 rows into sheet1 into corresponding coulmns)

    here i have attached the macro code, it is working fine up to some content but not satisfying my requirement.

    Any help would be highly appreciated.

    thanks in advance.

    Regards,
    Mallesham
    Attached Files Attached Files
    Last edited by katnam21; 01-12-2012 at 06:58 AM. Reason: for clear understanding

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

    It will be good if you attach the workbook as well.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    01-12-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

    i have attached the sample xlsx file, please have a look

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

    Use this code. It will create a sheet called Temp for the comparisons and delete it at the end.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-12-2012
    Location
    chennai
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

    Hi Arlette,

    thanks for your quick reply and ur effort. this code is not working as per my requirement and since lack of my VB script knowledge i couldn't able to understand clearly your code. and more over my requirement got change again.

    now we no need to the copy whole row into sheet1. lets assume sheet3 has Request Number and Request Status( = complete or WIP), now we need to compare the Request Number with sheet1 and sheet2 if it does not exists in both sheets then we need to copy based on Request Status. If Request Status = Complete then copy into Sheet1 (copy only the request number into Request Number column, not whole row), and if request status = WIP then copy into sheet2.

    really i am running out of ideas to implement the requirement, your help would be really great .

    thanks in Advance.

    Regards,
    Mallesham

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Need a Macro for Compare and copy data from one sheet to another sheet in Excel.

    You said we need to copy the whole row into sheet1. However, if you check your attachment, the number of columns in Sheet3 do not match with Sheet1.

+ 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