Move Row with a specific text in a cell to different worksheet.

yonnmd

New Member
Joined
Apr 21, 2018
Messages
2
Hi to everyone
C:\Users\Yonn\AppData\Local\Temp\msohtmlclip1\01\clip_image001.gif
,
I use to check this forum a lot as a quest, but now I need your help because I am 0 in macros.
I have a task management file, where we assign task to a team consisting of 4 people, with specific deadlines. I want that when I will mark the status of a task as `done` and after this will press `Clean` cell at top, the macro will cut entire rows what are `done` and move them to worksheet Finished. I mention that we will work in this file the whole year, and in finished worksheet, rows should add below the last one.
Please find the xls on the link below.
Ty.

https://drive.google.com/open?id=1tmOVG4EkYblKZwGWKTUlT4e6emnEM7cz
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Add a button in your workbook in sheet "ToDo" and when you double click the button you will reach the code window. Just paste the code below and let me know how it goes.

Code:
<code>
Private Sub CommandButton1_Click()


Call Summary


End Sub
Sub Summary()


On Error GoTo ErrorCatch


Dim ws As Worksheet


Dim newRng As Range


Dim LSearchRow As Integer
Dim i As Integer
Dim count As Integer


Set newRng = ThisWorkbook.Sheets("Finished").Range("A65335").End(xlUp).Offset(1, 0)
count = 0
ThisWorkbook.Sheets("ToDo").Select
            For LSearchRow = 3 To 250   'Can be customized as required
                If InStr(1, (Range("K" & CStr(LSearchRow)).Value), "Done") <> 0 Then
                    count = count + 1
                    Range("A" & CStr(LSearchRow), "L" & CStr(LSearchRow)).Select
                    Selection.Copy
                    newRng.Offset(count, 0).PasteSpecial xlPasteAll
                End If
            Next LSearchRow


Application.CutCopyMode = False     'clear clipboard
Sheets("Finished").Activate


ErrorCatch:
MsgBox Err.Description
End Sub
</code>
 
Last edited by a moderator:
Upvote 0
Another option
Code:
Sub MoveDone()
   With Sheets("ToDo")
      If .AutoFilterMode Then .AutoFilterMode = False
      .Range("A2:L2").AutoFilter 11, "Done"
      With .AutoFilter.Range.Offset(1).SpecialCells(xlVisible)
         .Copy Sheets("Finished").Range("A" & Rows.Count).End(xlUp).Offset(1)
         .EntireRow.Delete
      End With
      .ShowAllData
   End With
End Sub
@Meesam_ali
When posting code please use code tags, the # icon in the reply window.
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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