A guess:
If the code is in a sheet's code-module and that sheet is not the active sheet, you will get that error.
This is because an unqualified reference like Range("A:A,B:B,E:E,F:F,G:G,I:I,J:J,K:K,R:R") in a sheet's code-module always refers to that sheet. If it's not the active sheet it can't select that range.
To avoid the error:
Qualify the reference: Worksheets("Zplan_producao").Range("A:A,B:B,E:E,F:F,G:G,I:I,J:J,K:K,R:R") or Sheet3.Range("A:A,B:B,E:E,F:F,G:G,I:I,J:J,K:K,R:R") (here I've guessed the code name for that sheet).
Avoid selecting altogether, so instead of:
Worksheets("Zplan_producao").Select
ActiveSheet.ListObjects("Z_Plan_Oficial").Range.AutoFilter Field:=2, Criteria1:="=ABER"
use:
Worksheets("Zplan_producao").ListObjects("Z_Plan_Oficial").Range.AutoFilter Field:=2, Criteria1:="=ABER"
or instead of:
ActiveSheet.ListObjects("Z_Plan_Oficial").Range.AutoFilter Field:=2, Criteria1:="=ABER"
Range("A:A,B:B,E:E,F:F,G:G,I:I,J:J,K:K,R:R").Select ' ----> ERROR
Selection.Copy
Sheets("Encomendas_em_aberto").Select
Range("A1").Select
ActiveSheet.Paste
try:
With Worksheets("Zplan_producao")
.ListObjects("Z_Plan_Oficial").Range.AutoFilter Field:=2, Criteria1:="=ABER"
.Range("A:A,B:B,E:E,F:F,G:G,I:I,J:J,K:K,R:R").Copy Sheets("Encomendas_em_aberto").Range("A1")
End With
Does the code have to be in a sheet's code-module?
(Now you're going to tell me the code's not in a sheet's code-module! )