Hi All,
i have the below VBA code. when a row is marked as "CLOSED" on another tab the row moves to a new tab. but there seems to be an error with the code as it only allows 2 rows in the new tab then starts to overwrite the rows. any help on how to fix this will be highly appreciated!
i have the below VBA code. when a row is marked as "CLOSED" on another tab the row moves to a new tab. but there seems to be an error with the code as it only allows 2 rows in the new tab then starts to overwrite the rows. any help on how to fix this will be highly appreciated!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Value = vbNullString Then Exit Sub
If Intersect(Target, Columns("S:S")) Is Nothing Then Exit Sub
Dim bottomA As Long
bottomA = Sheet16.Cells(Cells(Rows.Count, 1).End(xlUp).Row, 1).End(xlUp).Offset(1).Row
Application.ScreenUpdating = False
If Target.Value = "CLOSED" Then
Target.EntireRow.Copy Sheet16.Cells(bottomA, 1)
Sheet16.Range("X" & bottomA) = Now
Sheet16.Range("Y" & bottomA) = Application.UserName
Target.EntireRow.Delete
End If
Sheet16.Columns.AutoFit
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub