ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   COPY ROW (https://www.excelbanter.com/excel-programming/407732-copy-row.html)

Rpettis31

COPY ROW
 
I am testing to see if the value on in a row is true and If it is true I
would like to paste the row to the next sheet on the first available blank
line.

For DLV = 2 to 1000
For DLV2 = 2 to 1000
If cells(dlv,23) "" and also cells(dlv,8) < !DLV CONTAINERS cells(dlv2,8)
then copy this row to sheet DLV CONTAINERS.

I am also not sure if I am referencing the sheet correctly in the if
statement.

Thanks
Robert

JLGWhiz

COPY ROW
 
I didn't test this but it should do the job.

If Cells(dlv, 23) "" And Cells(dlv, 8) < _
Sheets("DLV CONTAINERS").Cells(dlv2, 8) Then
lr = Sheets("DLV CONTAINERS").Cells(Rows.Count).End(xlUp).Row
Rows(dlv).Copy Sheets("DLV CONTAINERS").Range("A" & lr + 1)
End If

Check for line wraps in case I didn't get the attenuation mark right.

"Rpettis31" wrote:

I am testing to see if the value on in a row is true and If it is true I
would like to paste the row to the next sheet on the first available blank
line.

For DLV = 2 to 1000
For DLV2 = 2 to 1000
If cells(dlv,23) "" and also cells(dlv,8) < !DLV CONTAINERS cells(dlv2,8)
then copy this row to sheet DLV CONTAINERS.

I am also not sure if I am referencing the sheet correctly in the if
statement.

Thanks
Robert


Rpettis31

COPY ROW
 
It sort of works it just takes the last know value row that was true and
copy/pastes it. It is also slow, is there another way to speed it up. I
have updating false and my calc to manual.

"JLGWhiz" wrote:

I didn't test this but it should do the job.

If Cells(dlv, 23) "" And Cells(dlv, 8) < _
Sheets("DLV CONTAINERS").Cells(dlv2, 8) Then
lr = Sheets("DLV CONTAINERS").Cells(Rows.Count).End(xlUp).Row
Rows(dlv).Copy Sheets("DLV CONTAINERS").Range("A" & lr + 1)
End If

Check for line wraps in case I didn't get the attenuation mark right.

"Rpettis31" wrote:

I am testing to see if the value on in a row is true and If it is true I
would like to paste the row to the next sheet on the first available blank
line.

For DLV = 2 to 1000
For DLV2 = 2 to 1000
If cells(dlv,23) "" and also cells(dlv,8) < !DLV CONTAINERS cells(dlv2,8)
then copy this row to sheet DLV CONTAINERS.

I am also not sure if I am referencing the sheet correctly in the if
statement.

Thanks
Robert



All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com