I have created a worksheet to reflect project status. One of the columns is, surprisingly, "Project Status", which calls from a list of values. One of these values is "Completed".
I have two relevant sheets in the workbook, both with identical column structure: one to reflect projects In Flight, and the second to show Completed projects, so my objective is to implement code which would validate the project status cell (column R), and where the value is "Completed" the entire row will be copied to the Completed sheet and then deleted from the In Flight sheet.
I would also need a reverse solution to allow for human error. So in case the status was updated in error and the row moved, the user could then access the "Completed" tab, change the status back to something else other than "Completed" and then the row would be moved back to the In Flight sheet.
The row to be occupied, in either direction would be the next available empty row.
Hope that makes sense to someone...!
I have tried this, and it appears to do more-or-less what I am trying to achieve, but then Excel freezes! I think it is going into a loop somewhere but cannot locate it.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Set i = Sheets("InFlight")
Set e = Sheets("Completed")
d = 4
j = 5
Do Until IsEmpty(i.Range("R" & j))
If i.Range("R" & j) = "Completed" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
j = j + 1