Results 1 to 2 of 2

Thread: Copy & paste if condition matches

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2019
    Posts
    12

    Copy & paste if condition matches

    Hello Sir/Mam, I am looking for a Macro & i mentioned all the details below

    Either of these 2 conditions are to result in macro will copy value in column I of sample1.xls to field 2(column B) of text file Sample2.csv on a new line:
    Condition 1) Only If column K of sample1.xls is greater than Column D of sample1.xls & Column H of sample1.xls is Greater than column K of sample1.xls then Match Column I of sample1.xls with second field values (column B) of sample2.csv & if it is there then do nothing & if it is not present then paste the column I data of sample1.xls to append second field values (column B) of sample2.csv

    Condition 2) Only If column K of sample1.xls is lower than Column D of sample1.xls & Column H of sample1.xls is lower than column K of sample1.xls then Match Column I of sample1.xls with second field values (column B) of sample2.csv & if it is there then do nothing & if it is not present then paste the column I data of sample1.xls to append second field values (column B) of sample2.csv

    Plz Note
    All files are located in a different path (So in the macro the path will be hardcoded, Assume any path & I will edit the path manually by myself)
    Sheet name can be anything
    Macro will be putted in a vba.xlsm

    Sorry i was unable to upload the files so i shared the link below
    https://drive.google.com/file/d/1C_c...ew?usp=sharing
    https://drive.google.com/file/d/15xV...ew?usp=sharing

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Copy & paste if condition matches

    the links are not downloadable
    post here, zip the files first
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width