ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy data from one excel to another (https://www.excelbanter.com/excel-programming/435994-copy-data-one-excel-another.html)

Terrence Brown

Copy data from one excel to another
 
I need to compare one row in one excel (Wx) with another excel (Wy) and if they are same, i need to copy the adjacent cell info from Wy to Wx correspondingly.

Say Wx is the first sheet and the column is BO and Wy is the second excel and the column is E and these two columns are to be compared and for the same values the corresponding info from the column C of Wy has to be copied in to the column BX of Wx

EggHeadCafe - Software Developer Portal of Choice
Fast KeyWord String searching Algorithms
http://www.eggheadcafe.com/tutorials...ing-searc.aspx

Per Jessen

Copy data from one excel to another
 
Hi

Try this:

Sub CompareCopy()
Dim shA As Worksheet
Dim shB As Worksheet
Set shA = Worksheets("Wx")
Set shB = Worksheets("Wy")

FirstRow = 2 'Headings in row 1
LastRow = shA.Range("BO" & Rows.Count).End(xlUp).Row

For Each cell In shA.Range("BO" & FirstRow & ":BO" & LastRow)
Set f = shB.Columns("E").Find _
(what:=cell.Value, Lookat:=xlWhole, LookIn:=xlValues)
If Not f Is Nothing Then
f.Offset(0, -1).Copy cell.Offset(0, 8)
Set f = Nothing
End If
Next
End Sub


Regards,
Per

"Terrence Brown" skrev i meddelelsen
...
I need to compare one row in one excel (Wx) with another excel (Wy) and if
they are same, i need to copy the adjacent cell info from Wy to Wx
correspondingly.

Say Wx is the first sheet and the column is BO and Wy is the second excel
and the column is E and these two columns are to be compared and for the
same values the corresponding info from the column C of Wy has to be
copied in to the column BX of Wx

EggHeadCafe - Software Developer Portal of Choice
Fast KeyWord String searching Algorithms
http://www.eggheadcafe.com/tutorials...ing-searc.aspx




All times are GMT +1. The time now is 05:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com