I've been working on a macro in Excel that sorts through a table in one sheet ("Minor") and when a criteria is met it should add data from that table to another one in a second sheet ("Sheet1"), but I keep running with the 1004 error "object not defined" and I don't understand why, please help. Thanks!
Sub ord_esp_aprob()
  a = Worksheets("Minor").Cells(Rows.Count, 1).End(xlUp).Row
  b = Worksheets("Sheet1").Cells(Rows.Count, 4).End(xlUp).Row + 1
  For i = 3 To a
    If Worksheets("Minor").Cells(i, 1).Value = "Orden en Espera de Aprobación" Then
      Worksheets("Sheet1").Range(Cells(b, 4)).Value = Worksheets("Minor").Range(Cells(i, 2)).Value '(This is where the error occurs)
      Worksheets("Sheet1").Activate
    End If
  Next i
End Sub
 
     
    