LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default timer issue

I have data in sheet called "Safety Injection" that controls a 60 second
timer. This data comes from another sheet "Pressure" which I can change
manually. When I change the data in "Pressure" to start the timer, I get an
hourglass cursor preventing me from going to sheet "Safety Injection" to view
the timer. However, when I am simply on "Safety Injection" and manually force
the cell ("I22") controlling the timer to activate (remove the external link
and put number that I want), the timer works just fine. It's the switching
from sheet "Pressure" to "Safety Injection" while timer is running on "Safety
Injection" that is giving me problems.

Thanks in advance!

This is the code written in the "Safety Injection":

Option Explicit

Const WS_RANGE As String = "I22"

Private mPrev As Variant

Private Sub Worksheet_Calculate()

On Error GoTo ws_exit
Application.EnableEvents = False

If Me.Range(WS_RANGE).Value < mPrev Then
With Me.Range(WS_RANGE)
If .Value = 1 Then
nCount1 = 60
Call RunTimer1
ElseIf .Value = 0 Then
nCount1 = 0
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
mPrev = Me.Range(WS_RANGE).Value
End Sub


This is the code written in the standard code module:

Public nCount1 As Long

Public Sub RunTimer1()
Dim aWB As Workbook
Dim aWS As Worksheet

Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Safety Injection")

If nCount1 = 0 Then

aWS.Range("W11") = nCount1
nCount1 = nCount1 - 1
Application.OnTime Now + TimeSerial(0, 0, 1), "RunTimer1"
End If
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer Brandon H Excel Discussion (Misc queries) 5 August 9th 07 01:54 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
Msg Box Timer Steph[_3_] Excel Programming 13 March 18th 05 06:40 PM
API Timer Function Issue Seth Excel Programming 1 January 15th 04 06:30 PM
Timer Steve R[_2_] Excel Programming 3 December 5th 03 07:54 PM


All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"