MaxxLevell
New Member
- Joined
- Nov 19, 2020
- Messages
- 14
- Office Version
- 365
- Platform
- Windows
Two or three weeks ago, I posted a question on here, and received answers from multiple helpful folks who helped me resolve my issue. As a result of that success, I now have a new issue that I've run into, and am hoping someone can direct me to an answer.
I originally requested help on copying a row from sheet1, to either sheet2 or sheet3, based on a 'Y' or 'N' in cell '19', and then deleting that row from sheet1. That code is here...
My new issue is that I would like to show the date that the 'Y' or 'N' was entered in the same cell on the destination sheet the row is copied to...instead of the 'Y' or 'N'. Is this something that I can modify the original code to do, and, if so, can I get some help with how to go about that?
I originally requested help on copying a row from sheet1, to either sheet2 or sheet3, based on a 'Y' or 'N' in cell '19', and then deleting that row from sheet1. That code is here...
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Lastrow As Long, Lastrow2 As Long
Dim ans As Long
On Error GoTo myerror
If Target.Cells.CountLarge > 1 Or IsEmpty(Target) Then Exit Sub
If Target.Column = 19 Then
Application.EnableEvents = False
Lastrow = Sheets("ICS Not Needed").Cells(Rows.Count, 1).End(xlUp).Row + 1
Lastrow2 = Sheets("ICS Completed").Cells(Rows.Count, 1).End(xlUp).Row + 1
ans = Target.Row
If Target.Value = "N" Then
Rows(ans).Copy Sheets("ICS Not Needed").Rows(Lastrow)
Rows(ans).Delete
End If
If Target.Value = "Y" Then
Rows(ans).Copy Sheets("ICS Completed").Rows(Lastrow2)
Rows(ans).Delete
End If
End If
myerror:
Application.EnableEvents = True
End Sub
My new issue is that I would like to show the date that the 'Y' or 'N' was entered in the same cell on the destination sheet the row is copied to...instead of the 'Y' or 'N'. Is this something that I can modify the original code to do, and, if so, can I get some help with how to go about that?