VBA to shift task when done

OGCV1

New Member
Joined
Nov 12, 2017
Messages
36
Hey Guys

So am new to VBA and am having a problem with the below:

Code:
Sub Worksheet_Change(ByVal Target As Range)    On Error Resume Next
    Application.EnableEvents = False
    If Target.Column = 2 And Target.Value = "Done" Then
        LRowCompleted = Sheets("Jobs").Cells(Rows.Count, "L").End(xlUp).Row
        Range("A" & Target.Row).Copy Sheets("Jobs").Range("L" & LRowCompleted + 1)
        Range("M" & LRowCompleted + 1) = Format(Date, "mm/dd/yy")
        Range("A" & Target.Row & ":B" & Target.Row).Delete xlShiftUp
    End If
    If Target.Column = 4 And Target.Value = "Done" Then
        LRowCompleted = Sheets("Jobs").Cells(Rows.Count, "N").End(xlUp).Row
        Range("C" & Target.Row).Copy Sheets("Jobs").Range("N" & LRowCompleted + 1)
        Range("O" & LRowCompleted + 1) = Format(Date, "mm/dd/yy")
        Range("C" & Target.Row & ":D" & Target.Row).Delete xlShiftUp
    End If
     If Target.Column = 6 And Target.Value = "Done" Then
        LRowCompleted = Sheets("Jobs").Cells(Rows.Count, "P").End(xlUp).Row
        Range("E" & Target.Row).Copy Sheets("Jobs").Range("P" & LRowCompleted + 1)
        Range("Q" & LRowCompleted + 1) = Format(Date, "mm/dd/yy")
        Range("E" & Target.Row & ":F" & Target.Row).Delete xlShiftUp
    End If
     If Target.Column = 8 And Target.Value = "Done" Then
        LRowCompleted = Sheets("Jobs").Cells(Rows.Count, "R").End(xlUp).Row
        Range("G" & Target.Row).Copy Sheets("Jobs").Range("R" & LRowCompleted + 1)
        Range("S" & LRowCompleted + 1) = Format(Date, "mm/dd/yy")
        Range("G" & Target.Row & ":H" & Target.Row).Delete xlShiftUp
    End If
      If Target.Column = 10 And Target.Value = "Done" Then
        LRowCompleted = Sheets("Jobs").Cells(Rows.Count, "T").End(xlUp).Row
        Range("I" & Target.Row).Copy Sheets("Jobs").Range("T" & LRowCompleted + 1)
        Range("U" & LRowCompleted + 1) = Format(Date, "mm/dd/yy")
        Range("I" & Target.Row & ":J" & Target.Row).Delete xlShiftUp
    End If
    Application.EnableEvents = True

I have 5 projects on the go and each project has 2 columns (task and status). When a task for that project is complete I should be able to type Done in the status column and it will move that task to a completed list (which is the same layout but has the that is was completed in the status column)
This all seems to go swimmingly except that the date appears in all the status columns of the completed list and not just the project for which task it was.

Would appreciate any advice

Thanks in advance, OGCV
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You didn't qualify the Jobs worksheet for the dates

Code:
[B]Sheets("Jobs").[/B]Range("M" & LRowCompleted + 1) = Format(Date, "mm/dd/yy")
 
Upvote 0
AlphaFrog,

Thanks for the reply.
Tried this but still coming up with the same problem.

OGCV
 
Upvote 0

Forum statistics

Threads
1,214,925
Messages
6,122,301
Members
449,078
Latest member
nonnakkong

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