Results 1 to 7 of 7

Stop timer

Threaded View

aprildu Stop timer 02-22-2016, 09:16 PM
Philb1 Re: Stop timer 02-22-2016, 11:16 PM
aprildu Re: Stop timer 02-23-2016, 12:09 AM
Philb1 Re: Stop timer 02-23-2016, 02:27 AM
aprildu Re: Stop timer 02-23-2016, 12:08 PM
LJMetzger Re: Stop timer 02-23-2016, 12:26 PM
Philb1 Re: Stop timer 02-23-2016, 05:36 PM
  1. #1
    Forum Contributor aprildu's Avatar
    Join Date
    04-13-2014
    Location
    Barrie,On, Canada
    MS-Off Ver
    Excel 2016
    Posts
    175

    Stop timer

    I am trying to switch between two routines with a timer. The start works fine however the stoptimer throws a 1004 error. Can anyone point out the obvious (not obvious to me and that's why I am pulling my hair out). Many thanks!
    Public activeTimer As Boolean
    Public runWhen As Double
    Sub rotateRows()
        activeTimer = True
        If activeTimer = True Then
            hideRows
            showRows
        End If
    End Sub
    
    Sub hideRows()
    ActiveSheet.Rows("2:3").Hidden = true
    Application.OnTime Now() + TimeValue("00:00:03"), "hideRows"
    End Sub
    
    Sub showRows()
      ActiveSheet.Rows("2:3").Hidden = false
      Application.OnTime Now() + TimeValue("00:00:03"), "showRows"
    End Sub
    
    Sub stopTimer()
    activeTimer = False
    runWhen = Now() + TimeValue("00:00:03")
    Application.OnTime EarliestTime:=runWhen, Procedure:="rotateRows", Schedule:=False
    End Sub
    Last edited by aprildu; 02-22-2016 at 09:19 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Timer Stop when other CommandButton Clicked
    By iqballud in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2015, 09:23 AM
  2. Start/Stop timer
    By JonathanB2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2014, 07:00 AM
  3. how to stop a macro timer running more then once
    By sspreyer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-06-2013, 08:58 PM
  4. [SOLVED] Timer non-stop to run?
    By alee001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-30-2013, 03:46 PM
  5. stop watch and timer in excel
    By Suraj3825 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 05:50 AM
  6. Replies: 1
    Last Post: 12-12-2012, 08:46 PM
  7. stop this countdown timer macro
    By jacksten in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-25-2012, 10:57 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1