Macro for moving data to another worksheet

Solved/Closed
Nee_teen - Nov 22, 2011 at 05:26 AM
 Vince - Aug 3, 2015 at 11:06 PM
Hello,

I'm looking for support to create a condition based macro to copy rows from one worksheet to another in Excel.
I'm trying to create a To-Do workbook where-in I want to move my completed task to another worksheet of the same workbook.
Any ideas would be deeply appreciated as I do not have much experience with VBA.

Thanking you in advance for your kind support.

Regards,
Nitin



2 responses

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Dec 9, 2011 at 11:00 AM
Most easy approach would be that
you have a column that keeps the status. When ever you are ready
you can fillter the sheet on "complete" status
copy all the visible rows to other sheet
delete all the visible rows
0
Thank you so much rizvisa1 for your kind support.
However what I was looking for is a macro enabled worksheet where I can maintain a log of my tasks (both completed & pending). I've attempted to create a logic but the problem is that any new completed task overwrites the earlier completed items. Cannot figure a way out :-(

Code ->

Set m = Sheets("list of action items")
Set n = Sheets("task completed")

Dim d
Dim j

d = 4
j = 5

Do Until IsEmpty(m.Range("J" & j))
If m.Range("J" & j) = "Completed" Then
d = d + 1
n.Rows(d).Value = m.Rows(j).Value
End If
j = j + 1
Loop

Dim c As Range
Do: Set c = Cells.Find("Completed", LookIn:=xlValues)
If c Is Nothing Then Exit Do
c.EntireRow.Delete
Loop

I shall be highly grateful if you can help in this regard.

Thanking you once again for your kind help!
Regards,
Nitin
0
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Dec 12, 2011 at 11:55 AM
Isnt it because you are saying that start pasting from row 4
You need to know what is the first available row

you can have some thing like this
d = n.Cells(Rows.Count, "J").End(xlUp).Row
If (d < 4) Then d = 4
0
Wow...it worked.
Thank you so much rizvisa1....I'm indeed grateful for your valuable support.
Take care, Cheers!!!
0