You could use a sheet change event. Right click the Current sheet tab,
select View Code and paste the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo ErrorHandler
Application.EnableEvents = False
If Target.Count = 1 And Target.Column = 4 And Target.Value = "Y" Then
Dim eRow As Long
eRow = Sheets("Completed").Cells(Rows.Count, 1).End(xlUp).Row + 1
Range(Cells(Target.Row, 1), Cells(Target.Row, 4)).Copy _
Sheets("Completed").Cells(eRow, 1)
Rows(Target.Row).Delete
End If
ErrorHandler:
Application.EnableEvents = True
End Sub
Hope this helps
Rowan
Freshman wrote:
Dear all,
I've created a workbook containing 2 worksheets namely, "Current" and
"Completed". My idea is using "Current" to contain existing records and
"Completed" to contain completed records. In "Current" worksheet, there are
rows of records with 3 columns headings. For example:
Student Name Age Date Join
My question is, if I add "Quit" as the 4th column heading, then if I fill
"Y" next to any records, the records will be removed from "Current" worksheet
immediately and update to the last record of "Completed" worksheet
automatically.
Can any worksheet functions or VBE codes be done? If yes, please kindly
advise.
Many many thanks.
|