This is the sheet specific macro that stops you going back or forward.
Private Sub Worksheet_Activate()
Sheets(MartinT).Select
End Sub
NB: The array is the max time on a sheet,
These are the main macros:
Option Base 1
Public MyArray As Variant
Public MartinT As Integer
Sub Auto_Open()
Sheets(1).Select
MyArray = Array(20, 30, 20, 30, 20, 30, 20, 30, 20, 30)
MartinT = 1
Application.OnTime Now + TimeValue("00:00:" & MyArray(MartinT)), "ChangeSheet"
End Sub
Sub ChangeSheet()
MyArray = Array(20, 30, 20, 30, 20, 30, 20, 30, 20, 30)
If MartinT < 1 Or MartinT > 10 Then MartinT = 1
If MartinT < 10 Then
MartinT = MartinT + 1
Sheets(MartinT).Select
Application.OnTime Now + TimeValue("00:00:" & MyArray(MartinT)), "ChangeSheet"
Else
On Error Resume Next
EndTime = CStr(Time + TimeSerial(0, 0, 5))
Application.OnTime EarliestTime:=EndTime, Procedure:="ChangeSheet", Schedule:=False
End If
End Sub
Bookmarks