Notifications
Clear all

Exibir planilhas sequencialmente por timer no excel

5 Posts
4 Usuários
0 Reactions
880 Visualizações
(@eng_gilnei)
Posts: 2
Active Member
Topic starter
 

Boa tarde, amigos

Desenvolvi alguns relatórios em um arquivo Excel, sendo que estes relatórios estão em 3 planilhas (abas) diferentes, Plan1, Plan2 e Plan3. Gostaria de executar uma macro (ou coisa parecida) de forma que a cada 5 minutos, automaticamente, fossem exibidas sequencialmente uma a uma as planilhas. Ou seja, abre-se a Plan1, 5 minutos depois a Plan2 é exibida, 5 minutos depois a Plan3, e 5 minutos depois volta para a Plan1, esse processo continua num ciclo (looping) até parar a macro ou fechar o arquivo.

Se alguém puder me ajudar, ficarei muito grato.

Gilnei Pereira
Fortaleza/CE

 
Postado : 16/04/2014 11:56 am
(@gtsalikis)
Posts: 2373
Noble Member
 

Seria algo assim (coloque em EstaPasta_de_Trabalho)

Não testado:

Option Explicit

Private Sub Workbook_Open()

Application.OnTime Now + TimeValue("00:05:00"), "Lopar_Planilha_GT"

End Sub


Sub Lopar_Planilha_GT()

Dim ws As Worksheet

ws = ActiveSheet

If ActiveSheet = Sheet("Plan1") Then
    Sheet("Plan2").Select
    Application.OnTime Now + TimeValue("00:05:00"), "Lopar_Planilha_GT"
End If

If ActiveSheet = Sheet("Plan2") Then
    Sheet("Plan3").Select
    Application.OnTime Now + TimeValue("00:05:00"), "Lopar_Planilha_GT"
End If

If ActiveSheet = Sheet("Plan3") Then
    Sheet("Plan1").Select
    Application.OnTime Now + TimeValue("00:05:00"), "Lopar_Planilha_GT"
End If

End Sub
 
Postado : 16/04/2014 12:14 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa tarde!!

Por favor, indique as postagens cruzadas!!!!!!!!!
http://profwillianexcel.forumeiros.com/ ... r-no-excel

Att

 
Postado : 16/04/2014 12:25 pm
(@wagner-morel-vidal-nobre)
Posts: 4063
Famed Member
 

Gilmar,

Acho que se código apresenta alguns erros...

Aproveitando seu código, fiz apenas algumas pequenas alterações:

Private Sub Workbook_Open()
    Application.OnTime Now + TimeValue("00:05:0"), "Lopar_Planilha_GT"
End Sub

Sub Lopar_Planilha_GT()
    Dim Aba As String
    
    Aba = ActiveSheet.Name
    
    If Aba = "Plan1" Then
        Sheets("Plan2").Select
        Application.OnTime Now + TimeValue("00:05:0"), "Lopar_Planilha_GT"
    End If
    
    If Aba = "Plan2" Then
        Sheets("Plan3").Select
        Application.OnTime Now + TimeValue("00:05:0"), "Lopar_Planilha_GT"
    End If
    
    If Aba = "Plan3" Then
        Sheets("Plan1").Select
        Application.OnTime Now + TimeValue("00:05:0"), "Lopar_Planilha_GT"
    End If
End Sub
 
Postado : 16/04/2014 1:21 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Veja se ajuda :
VBA – Planilha Slide Show
http://www.tomasvasquez.com.br/blog/mic ... slide-show

[]s

 
Postado : 16/04/2014 8:48 pm