Need some help combining 2 different VBA codes into my Excel sheet please.
Below are the separate codes for each and below that is what I have done to try to combine them and the error I am receiving. The top code is working but the bottom one is not. Not sure that it matters or not, but for the 2nd code, in order for column L to show "TRUE", it has to meet the following formula that I have in place: =IF(AND(TEXT(NOW()-B2,"[h]")*1>25,I2=""),TRUE,"")
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 k after row 1 and is set to "YES"
If Target.Column = 11 And Target.Row > 1 And Target.Value = "YES" Then
Application.EnableEvents = False
' Copy columns A to L to complete sheet in next available row
Range(Cells(Target.Row, "A"), Cells(Target.Row, "L")).Copy Sheets("COMPLETED").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
End Sub
------------------
Private Sub Worksheet_Changes(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 L after row 1 and is set to "TRUE"
If Target.Column = 12 And Target.Row > 1 And Target.Value = "TRUE" Then
Application.EnableEvents = False
' Copy columns A to L to complete sheet in next available row
Range(Cells(Target.Row, "A"), Cells(Target.Row, "L")).Copy Sheets("SLA EXCEEDED").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
End Sub
And here is currently what I have when I tried to combine the 2. I am getting a runtime error 424: Object required.
Below are the separate codes for each and below that is what I have done to try to combine them and the error I am receiving. The top code is working but the bottom one is not. Not sure that it matters or not, but for the 2nd code, in order for column L to show "TRUE", it has to meet the following formula that I have in place: =IF(AND(TEXT(NOW()-B2,"[h]")*1>25,I2=""),TRUE,"")
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 k after row 1 and is set to "YES"
If Target.Column = 11 And Target.Row > 1 And Target.Value = "YES" Then
Application.EnableEvents = False
' Copy columns A to L to complete sheet in next available row
Range(Cells(Target.Row, "A"), Cells(Target.Row, "L")).Copy Sheets("COMPLETED").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
End Sub
------------------
Private Sub Worksheet_Changes(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 L after row 1 and is set to "TRUE"
If Target.Column = 12 And Target.Row > 1 And Target.Value = "TRUE" Then
Application.EnableEvents = False
' Copy columns A to L to complete sheet in next available row
Range(Cells(Target.Row, "A"), Cells(Target.Row, "L")).Copy Sheets("SLA EXCEEDED").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
' Delete current row after copied
Rows(Target.Row).Delete
Application.EnableEvents = True
End If
End Sub
And here is currently what I have when I tried to combine the 2. I am getting a runtime error 424: Object required.