+ Reply to Thread
Results 1 to 9 of 9

Vba code to compare the 2 sheets and paste the values in 3rd sheet

  1. #1
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi all,

    I am very new to Excel macro. please help me to solve below macro.

    I have a workbook with 2 sheets. Both the sheet contains Column "Name,Avg,Max". Compare both the sheets and paste the Avg values in Sheet3(Avg) and Sheet4(Max). I have attached the sample file below. Let me know if you need more explanation.

    Anyone can help me to solve this?


    Thanks,
    Abinaya
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi there,

    take a look at attachement:
    comparison.xlsm

    Done with this code:
    Please Login or Register  to view this content.
    Hope it helps
    Regards
    Miroslav R.

    (If You like my solutions, feel free to add reputation.)

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    You could use VLOOK-UPs for this.

  4. #4
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi,

    Thanks for your help.
    this code helped me. but, still i want to do some more changes. if you explain this code in better way, it will be very helpfull for me to do changes. Could you be pls exaplain the code?

  5. #5
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi there,
    open attached file, and in VBA enviroment, You will find my commnets.
    comparison.xlsm

    If You still find something that is not clear for You, let me know, but try to debug first (click in 'Start' macro and hit F8 to debug line by line).

    Hope it helps

  6. #6
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi M.R,

    Thanks for your comments. it helped me. Thank you for that
    I need one more help from you. I did some changes in the result sheet. I merged the row 3&4 and named it as name of transactions. when i try to run the macro. i am getting error in the line

    "aRow = AVGsht.Cells(3, 1).End(xlDown).Row + 1"

    Could you pls help me to solve this?
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi there,
    slightly modified... I merged also the header in 'Maximum' sheet and now it should work as You required:
    comparison.xlsm

    Test and let me know

  8. #8
    Registered User
    Join Date
    05-21-2014
    Posts
    19

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    Hi M.R,
    Thank You Very much. I have tested the Code which you gave last week. It was working Well. Thank you so much for helping me.

  9. #9
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: Vba code to compare the 2 sheets and paste the values in 3rd sheet

    You are welcome!

    send from my xperia z via tapatalk

+ 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. [SOLVED] VBA Code to copy data from one sheet and paste to multiple other sheets
    By JimmyG. in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2013, 04:25 AM
  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] Copy paste values from sheets into one master sheet
    By nickmax1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-20-2013, 10:52 AM
  4. Replies: 3
    Last Post: 10-12-2012, 12:02 AM
  5. Compare Data from 2 sheets and paste absent data on third sheet
    By junyi.ho in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-06-2010, 11:48 PM

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