I have very basic excel workbook that I use as a PM to track projects. I added a simple script that I found through some googling that shifts rows into a completed sheet when selecting a dropdown value. The file now intermittently stops responding for long (30 second to 5 minute) intervals when performing tasks. Very irregularly too. Sometimes it works like a dream, sometimes I open it and it barely functions. Wondering if something in the script may be causing the issue. I attempted to create a new workbook and plug my data back in line by line and it helped for a little while and now the problem is occurring again at the same frequency. I am admittedly very ignorant to scripting and programming as a whole. Know some Python that's about it. Would appreciate any insight. The script is as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified 10/6/2021 7:34:59 PM EDT
If Target.Column = 3 Then
Application.EnableEvents = False
Dim r As Long
r = Target.Row
Dim Lastrow As Long
Dim ans As Variant
Lastrow = Sheets("Tasks Completed").Cells(Rows.Count, "C").End(xlUp).Row + 1
If Target.Value = "Complete" Then
ans = MsgBox("Move row to Tasks Completed sheet?", vbYesNo)
If ans = vbYes Then
Rows(r).Copy Sheets("Tasks Completed").Cells(Lastrow, 1)
Rows(r).Delete
End If
End If
End If
Application.EnableEvents = True
End Sub