Oi gente
Preciso de um macro que imprima planilhas específicas, por exemplo:
TURNO MATUTINO> Imprimir planilhas 1,5,6
TURNO VESPERTINO> Imprimir planilhas 2,3,4
TURNO INTERMEDIÁRIO> Imprimir planilhas 7,8,9
Eu estava utilizando:
Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1
Sub ImprimirMedidasMatutino()
Application.ScreenUpdating = False
On Error GoTo Sair
Sheets("1").Visible = True
Sheets("2").Visible = True
Sheets("3").Visible = True
Sheets("4").Visible = True
Sheets("6").Visible = True
Sheets("12").Visible = True
Sheets("20").Visible = True
Sheets("21").Visible = True
Sheets("25").Visible = True
Sheets("31").Visible = True
Sheets("32").Visible = True
Sheets("39").Visible = True
Sheets("42").Visible = True
Sheets("43").Visible = True
Sheets("45").Visible = True
Sheets(Array("1", "2", "3", "4", "6", "12", "20", "21", "25", "31", "32", "39", "42", "43", "45")).Select
ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True
Sair:
Sheets(Array("1", "2", "3", "4", "6", "12", "20", "21", "25", "31", "32", "39", "42", "43", "45")).Visible = False
Sheets("Por Operação").Select
Application.ScreenUpdating = True
End Sub
Sub ReexibirPlanilhasMatutino()
Application.ScreenUpdating = False
Sheets("1").Visible = True
Sheets("2").Visible = True
Sheets("3").Visible = True
Sheets("4").Visible = True
Sheets("6").Visible = True
Sheets("12").Visible = True
Sheets("20").Visible = True
Sheets("21").Visible = True
Sheets("25").Visible = True
Sheets("31").Visible = True
Sheets("32").Visible = True
Sheets("39").Visible = True
Sheets("42").Visible = True
Sheets("43").Visible = True
Sheets("45").Visible = True
Sheets("Por Operação").Select
Application.ScreenUpdating = True
End Sub
Sub OcultarPlanilhas()
Application.ScreenUpdating = False
Sheets("1").Visible = False
Sheets("2").Visible = False
Sheets("3").Visible = False
Sheets("4").Visible = False
Sheets("6").Visible = False
Sheets("12").Visible = False
Sheets("20").Visible = False
Sheets("21").Visible = False
Sheets("25").Visible = False
Sheets("31").Visible = False
Sheets("32").Visible = False
Sheets("39").Visible = False
Sheets("42").Visible = False
Sheets("43").Visible = False
Sheets("45").Visible = False
Sheets("Por Operação").Select
Application.ScreenUpdating = True
End Sub
Porém ela parou de funcionar, apresentando erro de execução de um dia pro outro.