Hi,
I have been able to move the specific rows from one sheet to another using a value in a specific cell (using a drop down list).
I have used the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("P:P")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Application.ScreenUpdating = False
Dim Lastrow As Long
Dim Lastrowa As Long
Lastrow = Sheets("2021").Cells(Rows.Count, "P").End(xlUp).Row + 1
If Target.Value = "Yes" Then
Rows(Target.Row).Copy Destination:=Sheets("2021").Rows(Lastrow)
Application.EnableEvents = False
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
My question are:
1. When the data is cut to the new sheet, can the data in particular cells be removed (i.e left blank) (columns H to O to be blank on the new sheet)
2. Also when the data is cut to the new sheet, can the dates in the cells be updated for example by 1 year? (columns E & F to increase date by one year)
This is my first time posting and not sure how to attach my working file.
Thanks
I have been able to move the specific rows from one sheet to another using a value in a specific cell (using a drop down list).
I have used the following code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("P:P")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Application.ScreenUpdating = False
Dim Lastrow As Long
Dim Lastrowa As Long
Lastrow = Sheets("2021").Cells(Rows.Count, "P").End(xlUp).Row + 1
If Target.Value = "Yes" Then
Rows(Target.Row).Copy Destination:=Sheets("2021").Rows(Lastrow)
Application.EnableEvents = False
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
Application.EnableEvents = True
Application.ScreenUpdating = True
End If
End Sub
My question are:
1. When the data is cut to the new sheet, can the data in particular cells be removed (i.e left blank) (columns H to O to be blank on the new sheet)
2. Also when the data is cut to the new sheet, can the dates in the cells be updated for example by 1 year? (columns E & F to increase date by one year)
This is my first time posting and not sure how to attach my working file.
Thanks