Hi
I'm new here, I'm Debbie and hoping to get some help with a holiday and sickness planner I have been creating.
I am looking for a way to copy data from one worksheet to another in a different workbook (I'm using Excel 2010).
I have identical column headers in two worksheets, columns D through to Column I have data in. If the data in columns D to I matches the Data in Columns D to I on the other worksheet I want it to copy columns J to L into the other workbook. the data could be on different rows in each workbook, would anyone know of a way to do this please?
I tried putting a code into column B to use as the search region, but then I'd have to write code for each line and there are a lot, however the code I tried to write didn't work anyway (I'm fairly new to VBA).
Thanks in advance for any help with this
I'm new here, I'm Debbie and hoping to get some help with a holiday and sickness planner I have been creating.
I am looking for a way to copy data from one worksheet to another in a different workbook (I'm using Excel 2010).
I have identical column headers in two worksheets, columns D through to Column I have data in. If the data in columns D to I matches the Data in Columns D to I on the other worksheet I want it to copy columns J to L into the other workbook. the data could be on different rows in each workbook, would anyone know of a way to do this please?
I tried putting a code into column B to use as the search region, but then I'd have to write code for each line and there are a lot, however the code I tried to write didn't work anyway (I'm fairly new to VBA).
Code:
Sub FindandPaste()
Dim codename As String
Dim Finalrow As Integer
Dim i As Integer
Workbooks.Open ("C:\Users\Margaret\Desktop\newest")
codename = Workbooks("Master").Worksheets("Holiday Requests").Range("B6").Value
Finalrow = Workbooks("Newest").Worksheets("Holiday Requests").Range("D1000").End(xlUp).Row
For i = 2 To Finalrow
If Cells(i, 1) = codename Then
Cells("codename").Offset(6).Copy
Cells(i, 10).PasteSpecial xlPasteFormulasAndNumberFormats
End If
Next i
End Sub
Thanks in advance for any help with this