+ Reply to Thread
Results 1 to 7 of 7

Compare Two Columns In Two Different Sheets Then Copy Paste

  1. #1
    Forum Contributor
    Join Date
    09-13-2013
    Location
    Saudi Arabia
    MS-Off Ver
    2010, 2013
    Posts
    192

    Compare Two Columns In Two Different Sheets Then Copy Paste

    Hello,

    I am looking for a help in VBA. I am always copy past manually around 250-300 records on daily basis.

    The request is, I need to look column CE values from worksheets (Main Sheet) to column A in worksheets (List) and copy to the min sheet if the value match.

    For example:
    From Main sheet if the value 3126 found in worksheet list then copy the value in same row to the Main Sheet and also copy the column c date into Main Sheet.

    But while pasting the date it should 1 year previous date as the date in worksheet List is end date and I have to put start date.

    Sample workbook is attached for your reference.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Compare Two Columns In Two Different Sheets Then Copy Paste

    Not understanding 1 year previous date as date. So for 3126 what would be the output?
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Contributor
    Join Date
    09-13-2013
    Location
    Saudi Arabia
    MS-Off Ver
    2010, 2013
    Posts
    192

    Re: Compare Two Columns In Two Different Sheets Then Copy Paste

    Thanks Mike for your response,

    I mean to say while copy the data from worksheets List can we change the date 1 year back.

    Let say if record 3126 found in the column and copy the date from column B as it is but for column C if should return 25-12-2017.

    If can be possible it is Ok or just need to copy the data.

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Compare Two Columns In Two Different Sheets Then Copy Paste

    Give this a try

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    09-13-2013
    Location
    Saudi Arabia
    MS-Off Ver
    2010, 2013
    Posts
    192

    Re: Compare Two Columns In Two Different Sheets Then Copy Paste

    Thanks mike it is working but I forget to mentioned a validation.

    The validation is on worksheets Main Sheets if the cell value on column CM is "CCHI Expired" and CE cell value is matching on worksheets List column A then only it will copy the value. Can it be possible.

    And 1 more thing the date is converting to 1 year previous but the day is not correct.

    When you copy it will be 25-12-2017 but your script is keeping the day same and changing the year.

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,551

    Re: Compare Two Columns In Two Different Sheets Then Copy Paste

    Give this a try

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-13-2013
    Location
    Saudi Arabia
    MS-Off Ver
    2010, 2013
    Posts
    192

    Re: Compare Two Columns In Two Different Sheets Then Copy Paste

    Thanks for your response.

    it is working but it is overwriting all the records. but I need to change the dates only for the cell value which is CCHI Expired in column CM.

+ 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. Compare the values of 2 columns, then copy paste
    By efialtisgr in forum Excel General
    Replies: 1
    Last Post: 10-15-2014, 07:37 PM
  2. Compare two sheets,copy and paste unique rows based on values in 2 columns
    By ooggiemobile in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-02-2013, 03:58 AM
  3. [SOLVED] Compare 2 pair of columns then copy value of third column over different sheets
    By a3des in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-13-2012, 09:11 AM
  4. Macro to Compare Columns and Copy Paste Data
    By Jiptastic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-01-2012, 01:15 PM
  5. [SOLVED] Macro to compare data between sheets and copy/paste
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-24-2012, 05:46 PM
  6. [SOLVED] Compare Columns A& B on Sheets M and D, if A matches and B doesnt Copy B, else new row
    By Spyderz in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-12-2012, 05:55 PM
  7. Compare Two Columns In Two Worksheets To Copy And Paste A Third Column
    By uopint in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2007, 05:03 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