Consulting

Results 1 to 7 of 7

Thread: Copy + Find + Past (2 Files)

  1. #1
    VBAX Regular
    Joined
    Dec 2015
    Posts
    89
    Location

    Copy + Find + Past (2 Files)

    Dear All

    I need a Macro to search on file then copy specific value and past on another file.

    The video attached showing the process and i attached also the sample working files @ http://www.mediafire.com/download/3m...3xcv53/all.zip

  2. #2
    VBAX Regular
    Joined
    Dec 2015
    Posts
    89
    Location
    Dear All

    61 view but no one single answer for that simple request ?!!!!

  3. #3
    Re: 61 view but no one single answer for that simple request ?!!!!
    Do you think that that is because people don't know, people don't want to download (virus problems) or your explanation lacks sufficient information?
    I think quite a few people won't take the time to answer if the person asking for help is not willing to describe his problem properly.

  4. #4
    VBAX Regular
    Joined
    Dec 2015
    Posts
    89
    Location
    Sorry sir if i provided lack information for my request; all the matter is that my English is not good enough to describe my request in words so i did that short video.

    Simply I've 2 sheets, I want to pick a value from the 1st sheet (columnA) then search for it on the 2nd sheet then pick up the value beside (columnB) then back to 1st sheet and past that copied value on ColumnC.

    I put here some screenshots:

    111.jpg

    222.jpg

  5. #5
    Are both files, not the sheets, open? The file with the code in it will be changed to an .xlsm file, not as you show an .xlsx file
    Re: "I want to pick a value". Would that mean that you select a cell and then run the code? Or would you want to do that for all data in column A?

  6. #6
    You could try this. Both workbooks need to be open and the code, obviously, goes in "File1.xlsm".
    Sub Maybe_This()
        Dim wb1 As Workbook, wb2 As Workbook
        Dim c As Range
        Set wb1 = Workbooks("File1.xlsm")    '<---- Change filename as required
        Set wb2 = Workbooks("File2.xlsx")    '<---- Change filename as required
        wb2.Activate
        Application.ScreenUpdating = False
        'In the following two lines, change the sheet names as required
        For Each c In wb1.Sheets("Sheet1").Range("A6:A" & wb1.Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row)
            c.Offset(, 2).Value = wb2.Sheets("Sheet1").Columns(1).Find(c.Value, , , 1).Offset(, 1).Value
        Next c
        wb1.Activate
        Application.ScreenUpdating = True
    End Sub

  7. #7
    VBAX Regular
    Joined
    Dec 2015
    Posts
    89
    Location
    Well Done sir; It works very well.

    I'm thanking you very very very much

Posting Permissions

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