I trying to get this code to run, its just a sample for learning purposes
can you tell me why I would get a
"runtime error 424 object required" on line 7
Its supposed to copy the rows that have Car in column 1 to sheet 2
Thanks
Dave
Sub mycar()
x = 2
Do While Cells(x, 1) <> ""
If Cells(x, 1) = "Car" Then
Worksheets("Sheet1").Rows(x).Copy
Worksheets("Sheet2").Activate
eRow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Worksheets("Sheet2").Rows(eRow)
End If
Worksheets("Sheet1").Active
x = x + 1
Loop
End Sub
sample data:
Product Ref Worker
Car 67 Dave
Carpet 675 Merle
Seat 54645 Amber
Car 345 Wayne
CarSeat 9890 Oc
Mirror 34 Brian
Car 34 nelly
Seats 444 Sue
hubcap 4452 Rob
Car 333 Sean
can you tell me why I would get a
"runtime error 424 object required" on line 7
Its supposed to copy the rows that have Car in column 1 to sheet 2
Thanks
Dave
Sub mycar()
x = 2
Do While Cells(x, 1) <> ""
If Cells(x, 1) = "Car" Then
Worksheets("Sheet1").Rows(x).Copy
Worksheets("Sheet2").Activate
eRow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Paste Destination:=Worksheets("Sheet2").Rows(eRow)
End If
Worksheets("Sheet1").Active
x = x + 1
Loop
End Sub
sample data:
Product Ref Worker
Car 67 Dave
Carpet 675 Merle
Seat 54645 Amber
Car 345 Wayne
CarSeat 9890 Oc
Mirror 34 Brian
Car 34 nelly
Seats 444 Sue
hubcap 4452 Rob
Car 333 Sean