Move Rows To a Specific Worksheet Based on Entry in a Cell

StarFL

New Member
Joined
Dec 25, 2018
Messages
6
Hello - I've searched the forum, but not found anything that specifically addresses my issue.

I have a task list workbook that contains 4 sheets: Master, Today, Assigned and Done. All tasks are entered in Master, and I want to have the row deleted from Master and moved to the next available row on one of the other 3 worksheets based on the entry in column F - to Today if I enter a "T", Assigned if I enter "A" or Done if I enter "D".

I'm currently using code provided by My Aswer Is This (Thanks!) in response to another poster to move items from Master, Today and Assigned to Done. Works brilliantly and presumably still will for moving completed items from Today and Assigned to Done - but, I'd like to modify the code on the Master worksheet to move tasks to either T or A or D.

As my experience with VBA doesn't extend much further than copying and pasting code, I am hoping for the kind assistance of one more knowledgeable. The existing code is as follows:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)If Not Intersect(Target, Range("F:F")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim Lastrow As Long
Lastrow = Sheets("Done").Cells(Rows.Count, "F").End(xlUp).Row + 1


    If Target.Value = "D" Then
        Rows(Target.Row).Copy Destination:=Sheets("Done").Rows(Lastrow)
        Rows(Target.Row).Delete
    End If


End If
Exit Sub

End Sub


Thanks in advance for your help.

Star
 
Final solve. Thanks, Osvaldo!

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
 Dim ws As Worksheet
  If Target.Count > 1 Then Exit Sub
  If Target.Column <> 6 Then Exit Sub
   For Each ws In ThisWorkbook.Worksheets
    If Left(ws.Name, 1) = UCase(Target.Value) Then
     Cells(Target.Row, 1).Resize(, 7).Copy ws.Range("A" & ws.Cells(Rows.Count, 2).End(3)(2).Row)
     Rows(Target.Row).Delete
     Exit Sub
    End If
   Next ws
End Sub
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,216,146
Messages
6,129,142
Members
449,488
Latest member
qh017

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