erutherford
Active Member
- Joined
- Dec 19, 2016
- Messages
- 449
2 questions:
1. The code below worked fine as a "change event", but I decided to allow the user to edit the data then copy over to the "WO" sheet. However when I restructured it using a command button, the code gives a "Object Req" Error 424.
Question 2.
When the above code "crashes", I can reset it only by exiting excel completely. Shouldn't it be able to reset in the code window?
1. The code below worked fine as a "change event", but I decided to allow the user to edit the data then copy over to the "WO" sheet. However when I restructured it using a command button, the code gives a "Object Req" Error 424.
Code:
Private Sub CommandButton1_Click()
If Not Intersect(Target, Range("H:H")) Is Nothing Then
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
Dim Lastrow As Long
Lastrow = Sheets("WO").Cells(Rows.Count, "H").End(xlUp).Row + 2
If Target.Value = "1" Or Target.Value = "2" Or Target.Value = "3" Then Target.Copy Destination:=Sheets("WO").Range("H" & Lastrow) 'Copies Priority Rating to Col H.
If Target.Value = "1" Or Target.Value = "2" Or Target.Value = "3" Then Target.Offset(, -6).Copy Destination:=Sheets("WO").Range("A" & Lastrow) 'Copies Item to Col.A
If Target.Value = "1" Or Target.Value = "2" Or Target.Value = "3" Then Target.Offset(, -5).Copy Destination:=Sheets("WO").Range("B" & Lastrow) 'Copies Issues to Col.B
If Target.Value = "1" Or Target.Value = "2" Or Target.Value = "3" Then Target.Offset(, -4).Copy Destination:=Sheets("WO").Range("C" & Lastrow) 'Copies Est. to Col.C
End If
End Sub
Question 2.
When the above code "crashes", I can reset it only by exiting excel completely. Shouldn't it be able to reset in the code window?