Copy row information one workbook to another

excelenergy

Board Regular
Hello,

I have two workbooks.
Workbook1 and
Workbook2
I would like Workbook2 to look for only my dogs name in Workbook1, cell C6 then once is name is found pull all the corresponding row information from A1 to H1 then paste it into Workbook2, cell A1 to H1.

I there a formula for this? VLookup wont work :(
 
Last edited:

DanteAmor

Well-known Member
I would go with vlookup but you would have to do 1 formula in each cell from A1 to H1

CellFormula
A1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,1,0)
B1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,2,0)
C1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,3,0)
D1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,4,0)
E1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,5,0)
F1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,6,0)
G1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,7,0)
H1=VLOOKUP(C6,[workbook1.xlsx]Hoja1!$A:$H,8,0)

<tbody>
</tbody>


With macro:

Code:
Sub Copy_row()
    Set l1 = Workbooks("workbook1.xlsx")
    Set h1 = l1.Sheets(1)
    Set b = h1.Columns("A").Find(ActiveSheet.Range("C6").Value, lookat:=xlWhole, LookIn:=xlValues)
    If Not b Is Nothing Then
        h1.Rows(b.Row).Copy Range("A1")
    End If
End Sub
 
Last edited:

Some videos you may like

This Week's Hot Topics

Top