Hi
I have set timer in the attached sample sheet to run every 30 seconds thru VBA but it runs only once
I am not sure what mistake I have done hence seeking help
Hi
I have set timer in the attached sample sheet to run every 30 seconds thru VBA but it runs only once
I am not sure what mistake I have done hence seeking help
Last edited by grcshekar; 09-24-2023 at 10:18 AM.
When you set a timer, it only fires once. If you want it to repeat you have to set it again. In Workbook_Open you set the timer to call recalculate but then recalculate does not reset the timer. It needs the same code as in Workbook_Open to set the timer.
You have some other problems in Workbook_Open:
- You set range_Timer to A1 but then refer to range_Timer.Range("A1"). This will not cause an error but is redundant.
- The value on sheet Timer is already a time value so does not need to be converted to text and then back to time.
- You flow through to your error handler code so it will execute every time, even when there is no error.
Also recalculate should be a Sub, not a Function. It does not return anything.
I have fixed these problems as well.
Please use Report Post only to report a rule violation or other concern that must be reviewed by Moderators. If you wish to respond to a thread post, just click Reply.
Originally Posted by grcshekar
Last edited by 6StringJazzer; 09-25-2023 at 08:00 AM. Reason: cut down quote
Apoloiges instead of post it became report
Last edited by 6StringJazzer; 09-25-2023 at 08:00 AM. Reason: removed quote of entire post
Thank you it worked
Last edited by 6StringJazzer; 09-25-2023 at 07:59 AM. Reason: removed quote of entire post
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks