I use a macro called StartSlideShow to cycle through my excel sheet which will be on a display 24/7. However, I wanted to add some functionality where if someone hits the say "Stop slideshow" button it would end running the macro and allow people to add data to various sheets.
The macro StartSlideShow is shown below:
And I have the following buttons:
I have tried many things such as hitting the Esc key twice, using DoEvents then Esc keys. My laptop is a Dell Precision 5540 if that matters. Please help me in ending the macro when I hit the button.
Thank you and have a nice day.
The macro StartSlideShow is shown below:
VBA Code:
Sub StartSlideShow()
Application.OnTime Now + TimeValue("00:00:05"), "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
I have tried many things such as hitting the Esc key twice, using DoEvents then Esc keys. My laptop is a Dell Precision 5540 if that matters. Please help me in ending the macro when I hit the button.
Thank you and have a nice day.