copy and pasting cells from one sheet to another

harvistar

New Member
Joined
Feb 14, 2011
Messages
9
Hi,

I am new to excel and had this code working, but now, for some odd reason, will not work.

What is suppose to happen is when I open the document, the Rows that have a Hire Date (column C, row 5 onwards) in the Future Hirings Sheet equal to or greater than today's date (cell A3), then that row gets copied and pasted over to the Current Hirings Sheet. However, it is only copying one row at a time, whereas if multiple rows had a hire date equal to or greater than today's date, then they should all get copied and pasted over, however this is not happening.

Any help is appreciated.

Below is my code, as I cannot find where to attach my document...

Dim i As Long

With Sheets("FutureHirings")
For i = 5 To .Cells(.Rows.Count, "C").End(xlUp).Row
If .Cells(i, "C").Value >= .Cells(3, "A") Then
.Cells(i, "C").EntireRow.Copy Sheets("CurrentHirings").Cells(.Rows.Count, "C").End(xlUp).Offset(1, -2)
.Cells(i, "C").EntireRow.Delete
End If
Next
End With


Regards,
Travis
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
It works perfect for me. Do you have a date in A3?
Because it is comparing each date with A3 data & then copying the entire row to currenthiring sheet if >= range A3 date.

Are you getting any error message?
 
Upvote 0
I experiemented with it, and found that it is the line

.Cells(i, "C").EntireRow.Delete that is not allowing all rows to be pasted to the Current Hirings sheet. If I delete this line it works fine, but i want to remove the rows from the Future Hirings sheet once pasted. Is there a way around this?

Regards.
Travis
 
Upvote 0

Forum statistics

Threads
1,224,509
Messages
6,179,192
Members
452,893
Latest member
denay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top