Need to paste

  • Thread starter Thread starter Jason Morin
  • Start date Start date
J

Jason Morin

I'm receiving an error on the >>>>> line. What's wrong?


iLastRow1 = Cells(Rows.Count, "A").End(xlUp).Row

For i = iLastRow1 To 1 Step -1
With Cells(i, 1)
If .Value = 1 Then
.EntireRow.Cut
With Sheets("Recent History").Range(Cells
(iLastRow, "A"))
.Paste
End With......

Try to cut and paste a row onto a new sheet in a specific
location, but XL won't except the Paste command.

Thx.
Jason
 
Your ilast row, as written would refer to the ACTIVESHEET, not the
destination sheet
So, you would want a sourcelastrow and a destinationlastrow
try this - I did NOT test.

iLastRow1 = Cells(Rows.Count, "A").End(xlUp).Row
dlastrow= Sheets("Recent History").Cells(rows.count, "A").end(xlup).row
For i = iLastRow1 To 1 Step -1
With Cells(i, 1)
If .Value = 1 Then .EntireRow.Cut Sheets("Recent History").Cells
(dlastrow, "A"))
End With
next i
 
Hi Jason, another option might be to have the routine filter the data in the
source worksheet based on the 1 in that column, then have it do a go to special
visible cells and copy it to where you need to, then nip back and delete the
rows if you want them out of there.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top