Configurar Área de ...
 
Notifications
Clear all

Configurar Área de Impressão Várias Planilhas

8 Posts
3 Usuários
0 Likes
1,569 Visualizações
(@refernande)
Posts: 35
Eminent Member
Topic starter
 

Bom dia
Estou tentando usar uma macro para limpar a área de impressão de todas as planilhas de uma só vez "exceto Plan01" e aplicar a visualização de quebra de página.

Tentei rodar com essa macro mais só roda em cada planilha por vez.

Sub Config_Area_Imp

ActiveSheet.PageSetup.PrintArea = ""
ActiveWindow.View = xlPageBreakPreview

End Sub

 
Postado : 02/03/2018 7:52 am
(@mprudencio)
Posts: 2749
Famed Member
 

Veja se atende!


Sub LimparImpressão()

Dim WS As Worksheet

For Each WS In Worksheets
If WS.Name <> "Plan1" Then
With WS
.PageSetup.PrintArea = ""
.View = xlPageBreakPreview
End With
End If
Next WS

End Sub

Marcelo Prudencio
Microsoft Excel Brasil no Facebook

"Começar já é a metade do caminho."
Autor Desconhecido

Simplifica que simples fica.
Nicole Tomazella.

"O Simples é Sempre Melhor Que o Complicado"
Jorge Paulo Lemann.

 
Postado : 02/03/2018 8:18 am
(@refernande)
Posts: 35
Eminent Member
Topic starter
 

Boa Tarde
Não deu certo não a macro não rodou dando erro.
]

Veja se atende!


Sub LimparImpressão()

Dim WS As Worksheet

For Each WS In Worksheets
If WS.Name <> "Plan1" Then
With WS
.PageSetup.PrintArea = ""
.View = xlPageBreakPreview
End With
End If
Next WS

End Sub

 
Postado : 02/03/2018 10:08 am
(@mprudencio)
Posts: 2749
Famed Member
 

Tente este!

Sub LimparImpressão()

Dim WS As Worksheet

For Each WS In Worksheets
If WS.Name <> "Plan1" Then

WS.Select
WS.PageSetup.PrintArea = ""
ActiveWindow.View = xlPageBreakPreview

End If

Next WS

Sheets("Plan1").Select

End Sub

Marcelo Prudencio
Microsoft Excel Brasil no Facebook

"Começar já é a metade do caminho."
Autor Desconhecido

Simplifica que simples fica.
Nicole Tomazella.

"O Simples é Sempre Melhor Que o Complicado"
Jorge Paulo Lemann.

 
Postado : 02/03/2018 5:06 pm
(@refernande)
Posts: 35
Eminent Member
Topic starter
 

Bom dia
O código não está rodando.
Trava e da erro.

Tente este!

Sub LimparImpressão()

Dim WS As Worksheet

For Each WS In Worksheets
If WS.Name <> "Plan1" Then

WS.Select
WS.PageSetup.PrintArea = ""
ActiveWindow.View = xlPageBreakPreview

End If

Next WS

Sheets("Plan1").Select

End Sub

 
Postado : 05/03/2018 6:43 am
Basole
(@basole)
Posts: 487
Reputable Member
 

Experimente essa sugestão.

Sub PrintPreviewPrintArea_0()
    
    Dim ws As Worksheet
    Dim Pla1 As Worksheet
    With ThisWorkbook
    
    .Application.ScreenUpdating = False
    
    Set Pla1 = .ActiveSheet
    
    For Each ws In .Worksheets
        
        If ws.Name <> "Plan01" Then
            ws.Activate
            ws.PageSetup.PrintArea = ""
            ActiveWindow.View = xlPageBreakPreview
        End If
        
    Next ws
    
    Pla1.Activate
    .Application.ScreenUpdating = True
    
    End With
    
End Sub

Click em se a resposta foi util!

 
Postado : 05/03/2018 9:54 am
(@refernande)
Posts: 35
Eminent Member
Topic starter
 

Boa Tarde

Não está rodando travando tudo quando executa esse código.
Talvez para facilitar a vba uma que executasse todas as planilhas.

Experimente essa sugestão.

Sub PrintPreviewPrintArea_0()
    
    Dim ws As Worksheet
    Dim Pla1 As Worksheet
    With ThisWorkbook
    
    .Application.ScreenUpdating = False
    
    Set Pla1 = .ActiveSheet
    
    For Each ws In .Worksheets
        
        If ws.Name <> "Plan01" Then
            ws.Activate
            ws.PageSetup.PrintArea = ""
            ActiveWindow.View = xlPageBreakPreview
        End If
        
    Next ws
    
    Pla1.Activate
    .Application.ScreenUpdating = True
    
    End With
    
End Sub

 
Postado : 05/03/2018 1:42 pm
Basole
(@basole)
Posts: 487
Reputable Member
 

Tem muitas formulas nos intervalos das planilhas ?

Click em se a resposta foi util!

 
Postado : 05/03/2018 1:46 pm