Hello.
I would like to know if this macros is possible? If it is, would you mind explaining what exactly I should be doing, because I'm a total newcomer when it comes to Excel's macros.
Thank you very much guys&gals.
Best regards,
Aleksey.
Hello.
I would like to know if this macros is possible? If it is, would you mind explaining what exactly I should be doing, because I'm a total newcomer when it comes to Excel's macros.
Thank you very much guys&gals.
Best regards,
Aleksey.
Hi
It is possible, and you'll need to so some research on Application.OnTime. Basically, you'll set this to be 2hrs on opening, then cancel and reset on things like Sheet Selection Change or Sheet Change.
Cheers
Hope this helps
Sometimes its best to start at the beginning and learn VBA & Excel.
Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
Available for remote consultancy work PM me
Like I said, I'm really bad @ Excel marcoing, and when I try to do smth like this: http://www.biz-development.com/Softw...-Idle-Time.htm
It just does not work! I open the spreadsheet, go idle for a huge amount of time and nothing happens even tho the timer is set for 20 seconds, it kinda works if I hit Macros -> Reset (macro) and run it, but it just closes the spreadsheet in 20 seconds even tho I'm not idle.
Do some research on the way i suggested then, Application On Time and the Worksheet Change events.
Hi Aleksey,
Try below code in normal module.
In Thisworkbook module![]()
Dim DownTime As Date Sub SetTime() DownTime = Now + TimeValue("02:00:00") Application.OnTime DownTime, "ShutDown" End Sub Sub ShutDown() ThisWorkbook.Save ThisWorkbook.Close End Sub Sub Disable() On Error Resume Next Application.OnTime EarliestTime:=DownTime, Procedure:="ShutDown", Schedule:=False End Sub
![]()
Private Sub Workbook_Open() MsgBox "This workbook will after 2 hours of inactivity" Call SetTime End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Call Disable End Sub Private Sub Workbook_SheetCalculate(ByVal Sh As Object) Call Disable Call SetTime End Sub Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range) Call Disable Call SetTime End Sub
Regards,
Nandkumar S.
---------------------------------------------------------------
Don't forget to Click on * if you like my solution.
Dear Aleksey,
This is working. Try attached file I have change 25 seconds in it.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks