I am working on an excel dashboard and need to display 2 specific worksheets in the workbook and switch between tabs with an interval of 30 seconds per tab and then return to the first tab and repeat.
I found a macro that is similar to what I need, Excel - Automated Worksheet Switching Loop, however I am trying to only show 2 specific worksheets and not all worksheets in the workbook.
Here is the code that I am using:
Sub StartSlideShow()
Application.OnTime Now + TimeValue("00:00:30"), "ShowNextSheet"
End Sub
Sub ShowNextSheet()
Dim lastIndex As Integer, nextShtIndex As Integer
lastShtIndex = Worksheets.Count
nextShtIndex = ActiveSheet.Index + 1
If nextShtIndex <= lastShtIndex Then
Worksheets(nextShtIndex).Select
StartSlideShow
Else
Worksheets(1).Select
StartSlideShow
End If
End Sub