Macro for moving data to another worksheet [Solved/Closed]

Nee_teen - Nov 22, 2011 at 05:26 AM - Latest reply:  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



See more 

5 replies

rizvisa1 4481 Posts Thursday January 28, 2010Registration dateContributorStatus January 6, 2016 Last seen - Dec 9, 2011 at 11:00 AM
0
Thank you
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
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
rizvisa1 4481 Posts Thursday January 28, 2010Registration dateContributorStatus January 6, 2016 Last seen - 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
Wow...it worked.
Thank you so much rizvisa1....I'm indeed grateful for your valuable support.
Take care, Cheers!!!
0
Thank you
Can we have the complete formula please ?
It is still not working in my file.
Thank you for your help