I have a list of items in Sheet 1 (column A). Each item in sheet 1 has 5 cells of additional information (B thru F). Sheet 2 has some, even most of the same items at Sheet 1, but NOT ALL. I am trying to write a program that will start in Sheet 2, look at each item number in the A column, then check sheet 1 for the same number. When it finds the same number it will copy the B thru F cell information from sheet 1 and place it next to the items number in sheet 2 (B thru F).
I used For Loops to attempt to start on Sheet 2 cell A2. Attempted to set variable cSn to A2, then Loop thru Sheet 1 and if it finds cSn to copy data from sheet 1 to sheet 2.
In an attempt to see if the program was running correctly, I added a MsgBox to indicate when it found one.
The program seems to run, but wont copy the data and leave it. It appears to copy the data, then erase it, then paste the data on the last row of sheet 1 onto every line on sheet 2. I've searched this site and others for the correct Copy/Paste Syntax, but cant find it. I am using MS Visual Basic 7.1. Please Help! Here is what I have so far...
Sub CopyItemInfo()
Dim cSn As String
Sheets(1).Select
FinalRow1 = Cells(Rows.Count, 1).End(xlUp).Row
Sheets(2).Select
FinalRow2 = Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To FinalRow2
cSn = Sheets(2).Range("A" & x)
For y = 2 To FinalRow1
If Sheets(1).Range("A" & y) = cSn Then MsgBox "Found One " & cSn
Worksheets(1).Range("B" & y).Copy Destination:=Worksheets(2).Range("B" & x)
Worksheets(1).Range("C" & y).Copy Destination:=Worksheets(2).Range("C" & x)
Worksheets(1).Range("D" & y).Copy Destination:=Worksheets(2).Range("D" & x)
Worksheets(1).Range("E" & y).Copy Destination:=Worksheets(2).Range("E" & x)
Worksheets(1).Range("F" & y).Copy Destination:=Worksheets(2).Range("F" & x)
Application.ScreenUpdating = True
Next y
Next x
Application.ScreenUpdating = True
End Sub