VBA: Serach column for date, cut then paste row into new sheet

Pivol

New Member
Joined
Feb 20, 2015
Messages
2
Could some kind soul please advise me on VBA coding to complete the following;


  1. Search the Completed column (G) of the ToDo List worksheet for any date entries.
  2. If any entry found to cut and paste the entire row(s) onto the Archive worksheet (Ensuring they are pasted into the next free row).
  3. Re-sort the ToDo List worksheet into order for QofA (smallest to largest), then by To Do (oldest to newest)

If this could be placed into a button then super, but tbh this is just a nice addition.

Example Worksheet
QofAUIDLinkTo DoRefTaskCompletedComments
1313/02/15Test 113/02/15SAP updated.
1214/02/15Test 2
2416/02/15Test 315/02/15Task delegated ABV.
3513/02/15Test 4
4720/02/15Test 5

<tbody>
</tbody>

Thanks in advance.

Regards,
Clive
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi Clive. Try:
Code:
Sub CopyRows()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("ToDo List").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Sheets("ToDo List").Range("$A$1:$H$" & LastRow).AutoFilter Field:=7, Criteria1:="<>"
    Sheets("ToDo List").Range("$A$2:$H$" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("Archive").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
    Sheets("ToDo List").Range("$A$2:$H$" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    If Sheets("ToDo List").FilterMode Then Sheets("ToDo List").ShowAllData
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Hi Clive. Try:
Code:
Sub CopyRows()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("ToDo List").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Sheets("ToDo List").Range("$A$1:$H$" & LastRow).AutoFilter Field:=7, Criteria1:="<>"
    Sheets("ToDo List").Range("$A$2:$H$" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Copy Sheets("Archive").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
    Sheets("ToDo List").Range("$A$2:$H$" & LastRow).SpecialCells(xlCellTypeVisible).EntireRow.Delete
    If Sheets("ToDo List").FilterMode Then Sheets("ToDo List").ShowAllData
    Application.ScreenUpdating = True
End Sub

A HUGE thank you ever so much...this has been bugging me something rotten and is now resolved.
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,289
Members
449,077
Latest member
Rkmenon

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