Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Column <> 5 Or ActiveCell <> "Q" Then Exit Sub
Cells(ActiveCell.Row, 1).Select
If ActiveCell.Row < 40 Then Range(ActiveCell, "D39") = Range(ActiveCell(2), "D40").Value
Range("A40:D40") = ""
End Sub