Hi,
I have a problem that I could not solve.
I have two tables, where in column "A" of table 1 has values that appear in column "A" of table 2 (these tables are on separate sheets).
The data in column "A" in table 1 is never repeated.
The data in column "A" in table 2 are the same as in column "A" in table 1 but they are repeated.
I need a macro that looks for each of the cells in column A of table 1 in column A of table 2, and when they match, copy the row in table 1 and paste it over the row in table 2.
The data in table 1 should only be copied once in table 2, on the first cell that matches
I leave a sample file in case they need it, and this is the code that I have been occupying but it doesn't work for me.
Sub Findandcopy()
Dim lr As Long
Dim i As Integer
lr = Sheet1.Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To lr
If UCase(Sheet2.Cells(1, 1).Value) = UCase(Sheet1.Cells(i, 1).Value) Then
Sheet2.Cells(1, 1).Value = Sheet1.Cells(i, 1).Offset(, 1).Value
End If
Next i
End Sub
Thank you!!!
Bookmarks