Hi.
I am trying to do a macro that will copy rows from workbook x to workbook y where data in workbook x column a matches my argument in workbook y cell a1. hope this makes sense!
anyway i did this macro but it does not work.
Sub supermakro()
'x = dataark
'y = rapport
Dim x As Workbook
Dim y As Workbook
Dim xrow As Integer
Dim yrow As Integer
Set x = Application.Workbooks("\\dmsrv02\Faelles\DMprod rapporter\Excel Rapporter\Timesag data\timesag_data.xlsx").Sheets("ugedata")
Set y = ActiveWorkbook.Sheets("tsdata")
Set y2 = ActiveWorkbook.Sheets("uge_ra")
Set xrow = 1
Set yrow = 1
Do
If x.Range("A" & xrow) = y2.Range("A1") Then
Rows(xrow).Copy
y.Select
Rows(yrow).PasteSpecial
End If
xrow = xrow + 1
yrow = yrow + 1
Loop While xrow < 100
End Sub
Bookmarks