Sheet Change Timer

Chuckarou

New Member
Joined
Jul 12, 2018
Messages
19
Hi all,
I was wondering if it was possible to make my workbook change form any current sheet to Sheet1 if it is left untouched for more then 5 minutes.

I've looked around for solutions, but couldn't find anything to suit my needs.

Thanks in advance,
Chuckarou
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
.
Paste in ThisWorkbook Module :

Code:
Option Explicit


Private Sub Workbook_Open()
    StartTimer
End Sub


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    StartTimer
End Sub


Paste in a Routine Module :

Code:
Option Explicit


Const idleTime = 30 'seconds
Dim Start
Sub StartTimer()
    Start = Timer
    Do While Timer < Start + idleTime
        DoEvents
    Loop
    
    Sheets("Sheet1").Activate
    Sheets("Sheet1").Range("A1").Select
   
End Sub

Timer presently set for 30 seconds. You can edit the seconds from 30 to 300

Download workbook : https://www.amazon.com/clouddrive/share/VmpKfXmdKttUOY1ig0w1GcVd3TmlbxzLVntFNj4sJzP
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,459
Messages
6,124,945
Members
449,198
Latest member
MhammadishaqKhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top