Hello, I am trying to prevent an error where in a sharedbook multiple people clicking on Target cell" I" and Choose "Complete" column at the SAME SECOND, and end up pasting the results into the same (last) row end up overwrite the previous pasted value from a second ago, resulting deleting a record. . Is there a way to make excel to only run one VBA code at once? And run another code when the first code is fully completed in a shared environment? or some other method that can prevent this from happening. I've tried Application.EnableEvents code below and found no success. and Application.Screenupdating also doesnt work. Thank you so much!
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("I:I")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim Lastrow As Long
Application.EnableEvents = False
Lastrow = Sheets("Completed").Cells(Rows.Count, "A").End(xlUp).Row + 1
If Target.Value = "Complete" Then
Range(Cells(Target.Row, "A"), Cells(Target.Row, "B")).Copy
Sheets("Completed").Range("A" & Lastrow).PasteSpecial xlPasteValues
Rows(Target.Row).Delete
End If
Application.EnableEvents = True
End If
End Sub