VBA, copy lines with specific value
No, there was a typo in my code. This is what it should say
With Worksheets("Sheet1")
iLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = 1 To iLastRow
If .Cells(i, "A").Value = "CCC" Then
iNextRow = iNextRow + 1
.Rows(i).Copy Worksheets("Sheet2").Cells(iNextRow, "A")
End If
Next i
End With
--
HTH
Bob Phillips
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"Robert" wrote in message
oups.com...
Hi Bob,
Thanks a lot for the promt assistance!
When running the statement I get an error for .Rows(i).Copy
Worksheets("Sheet2").Cells(INextrRow,"A")
Can it be that you have to include some sort of offset function to
paste the first line in say A1 and for the following lines something
like End(xldown).Offset(1, 0).Select?
Thanks again
Rgds,
Robert
|