Hi All,
I have a master data sheet which contains item numbers with different components. Each item has many different components. There are therefore more than one line with the same item number but different components.
I would like to be able to type in a number in D2 for example in a new sheet and then it will copy all the lines which match with this article number from the master data sheet and paste it into B13 for example.
I get the error "invalid use of property", does anyone know how come?
I'm quite new to this and am trying to experiment a bit.
Sub Button2_Click()
a = Worksheets("data").Cells(Rows.Count, 1).End(xlUp).Row
For i = 13 To a
If Worksheets("data").Cells(i, 3).Value = "D2" Then
Worksheets("data").Rows(i).Copy
Worksheets("master").Activate
b = Worksheets("master").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("master").Cells(B13).Select
Activatesheet.Paste
Worksheets("data").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets ("data"), Cells(1, 1).Select
End Sub
I have a master data sheet which contains item numbers with different components. Each item has many different components. There are therefore more than one line with the same item number but different components.
I would like to be able to type in a number in D2 for example in a new sheet and then it will copy all the lines which match with this article number from the master data sheet and paste it into B13 for example.
I get the error "invalid use of property", does anyone know how come?
I'm quite new to this and am trying to experiment a bit.
Sub Button2_Click()
a = Worksheets("data").Cells(Rows.Count, 1).End(xlUp).Row
For i = 13 To a
If Worksheets("data").Cells(i, 3).Value = "D2" Then
Worksheets("data").Rows(i).Copy
Worksheets("master").Activate
b = Worksheets("master").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("master").Cells(B13).Select
Activatesheet.Paste
Worksheets("data").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets ("data"), Cells(1, 1).Select
End Sub