copy and paste by macro

  • All files are located in a different path

    vba code will be placed in a macro.xlsm

    i have two files 1.xls & 2.csv

    check wheather column H of 1.xls is greater or lower than column D of 1.xls

    if column H of 1.xls is greater than column D of 1.xls then match column I of 1.xls with column B of 2.csv & if it matches then put this symbol "<" in column D of 2.csv & copy paste the data of column K of 1.xls in column E of 2.csv

    or

    if column H of 1.xls is lower than column D of 1.xls then match column I of 1.xls with column B of 2.csv & if it matches then put this symbol ">" in column D of 2.csv & copy paste the data of column K of 1.xls in column E of 2.csv


    save and close both the file

    plz help me in solving this problem by vba

  • Possibly, but not tested...


    If I've been helpful, let me know. If I haven't, let me know that too.

  • Quote

    i tried the code but i met with an error with this line sir c = ws2.Columns(2).Find(.Cells(i, 9))


    Try changing both of the lines with that code to:


    Code
    1. c = ws2.Columns(2).Find(.Cells(i, 9).value)

    Btw, what was the error?

    If I've been helpful, let me know. If I haven't, let me know that too.

  • jhas,

    Using this code , I get the results pictured below:

    If I've been helpful, let me know. If I haven't, let me know that too.