PDA

View Full Version : [SOLVED] Copy + Find + Past (2 Files)



baset
04-12-2016, 12:52 PM
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/3mefty3yo3xcv53/all.zip

baset
04-14-2016, 05:02 AM
Dear All

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

jolivanes
04-15-2016, 10:12 AM
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.

baset
04-15-2016, 11:01 AM
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:

15935

15936

jolivanes
04-15-2016, 02:25 PM
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?

jolivanes
04-15-2016, 11:11 PM
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

baset
04-18-2016, 08:24 AM
Well Done sir; It works very well.

I'm thanking you very very very much :hi: