I found a code on another post that does almost exactly what I want my spreadsheet to do, but I’ve tried changing the code to align with my sheet and I somehow mess it up.
On a sheet called “Contact Log” if I change column H to “Active Client” (manually) I want it to automatically copy that row to a spreadsheet called “Lead Status” I do not want it to delete the row. I want it to copy the entire row to column A, row 2 and on.
I’ve tried changing this code and it almost works. The first time I change a cell to active client it’ll copy the row, but it copies the data to column N, stops after the first few data changes, or it copies each time but only to column N, row 2, which means it continuously replaces the data.
Private Sub Worksheet_Change(ByVal Target As Range)
' Check to see only one cell updated
If Target.CountLarge > 1 Then Exit Sub
' Check to see if entry is made in column B after row 5 and is set to "Yes"
If Target.Column = 2 And Target.Row > 5 And Target.Value = "Yes" Then
Application.EnableEvents = False
' Copy columns B to I to complete sheet in next available row
Range(Cells(Target.Row, "B"), Cells(Target.Row, "I")).Copy Sheets("Complete").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
End Sub
On a sheet called “Contact Log” if I change column H to “Active Client” (manually) I want it to automatically copy that row to a spreadsheet called “Lead Status” I do not want it to delete the row. I want it to copy the entire row to column A, row 2 and on.
I’ve tried changing this code and it almost works. The first time I change a cell to active client it’ll copy the row, but it copies the data to column N, stops after the first few data changes, or it copies each time but only to column N, row 2, which means it continuously replaces the data.
Private Sub Worksheet_Change(ByVal Target As Range)
' Check to see only one cell updated
If Target.CountLarge > 1 Then Exit Sub
' Check to see if entry is made in column B after row 5 and is set to "Yes"
If Target.Column = 2 And Target.Row > 5 And Target.Value = "Yes" Then
Application.EnableEvents = False
' Copy columns B to I to complete sheet in next available row
Range(Cells(Target.Row, "B"), Cells(Target.Row, "I")).Copy Sheets("Complete").Cells(Rows.Count, "B").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
End Sub
Automatically Move Row to Another Sheet Based On Cell Value
Hi all, Complete Excel and VBA newbie here, I'm trying to urgently find a solution to a VBA macro(?) that I need to create for work. Full disclosure, I have been trying to do this entirely via Googling and platforms like this amazing one! I'm trying to AUTOMATICALLY move a row of data from one...
www.mrexcel.com