title: Excel Timer with banner that changes in segments
body: <p>Trying to make a banner that changes through different segments of an allotted time.  The different segments are 15, 20, 25 minutes.  I have a setup page that the user can select the segment from a combobox. Then displays the workflow page Like so:</p>
  <p><a href="https://i.stack.imgur.com/AtVDO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AtVDO.png" alt="enter image description here" /></a></p>
  <p>This is a sample of what the banner should do for a 15 minute segment (pseudo code):</p>
  <pre><code>        When it starts (15 remaining)
              TimeBanner = &quot;Thinking Time&quot;
          After 1 minute (14 remaining) 
              TimeBanner = &quot;Response Time&quot;
          after 10 minutes (3 remaining)
              TimeBanner = &quot;Refine and Improve&quot;
          after 14 minutes(1 remaining) 
              TimeBanner = &quot;Submit&quot;
          after 15 minutes (0 remaining)
              TimeBanner = &quot;Time Up&quot;
         
  </code></pre>
  <p>The timer works, but the the banner doesn't change
  So I thought perhaps I just needed to add DoEvents, but it doesn't change</p>
  <p>Here's the code</p>
  <pre><code>Option Explicit
  
   Public interval As Date
   Sub timer()
  
       interval = Now + TimeValue(&quot;00:00:01&quot;)
  
       If Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value = 0 Then Exit Sub
       
      'Show the time elapsed
      Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value = Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value - TimeValue(&quot;00:00:01&quot;)
      DoEvents
  
      Sheets(&quot;VSS&quot;).Range(&quot;E3&quot;).Value = TimeBanner(Sheets(&quot;ControlData&quot;).Range(&quot;A7&quot;).Value, Minute(Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value))
      DoEvents
      
      'Show the Time Banner matching the Elapsed Time
      
     'MsgBox Minute(Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value)
  
     Application.OnTime interval, &quot;timer&quot;
     
     
     DoEvents
  
   End Sub
  
   Sub stop_timer()
          'Only allow 'Stop' if the timer has started
          
          Dim iMin As Integer
          iMin = Left(Format(Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value, &quot;mm:ss&quot;), 2)
          
          
       'i.e. if the time elapsed DOES NOT equal whatever they chose
       'It means that the timer has started
       
       If iMin &lt;&gt; Sheets(&quot;ControlData&quot;).Range(&quot;A7&quot;).Value Then
          Application.OnTime EarliestTime:=interval, Procedure:=&quot;timer&quot;, Schedule:=False
       End If
   End Sub
  
  Sub reset_timer()
      Sheets(&quot;VSS&quot;).Range(&quot;D1&quot;).Value = &quot;00:&quot; &amp; Sheets(&quot;ControlData&quot;).Range(&quot;A7&quot;).Value &amp; &quot;:00&quot;
  End Sub
  
  
  Function TimeBanner(iTimeChosen As Integer, iElapsedTime As Integer) As String
  
  Debug.Print &quot;Time chosen: &quot; &amp; iTimeChosen &amp; &quot;, Elapsed &quot; &amp; dtElapsedTime
  
  Select Case iTimeChosen
  
      Case 25
      
          Select Case iElapsedTime
              Case Is &lt;= 25
                  TimeBanner = &quot;Thinking Time&quot;
              Case Is &lt;= 23
                  TimeBanner = &quot;Response Time&quot;
              Case Is &lt;= 5
                  TimeBanner = &quot;Refine and Improve&quot;
              Case Is &lt;= 1
                  TimeBanner = &quot;Submit&quot;
              Case 0
                  TimeBanner = &quot;Time Up&quot;
          End Select
          
      Case 20
              Select Case iElapsedTime
              Case Is &lt;= 20
                  TimeBanner = &quot;Thinking Time&quot;
              Case Is &lt;= 18
                  TimeBanner = &quot;Response Time&quot;
              Case Is &lt;= 4
                  TimeBanner = &quot;Refine and Improve&quot;
              Case Is &lt;= 1
                  TimeBanner = &quot;Submit&quot;
              Case Is = 0
                  TimeBanner = &quot;Time Up&quot;
              End Select
      
      Case 15
              Select Case iElapsedTime
              Case Is &lt;= 15
                  TimeBanner = &quot;Thinking Time&quot;
              Case Is &lt;= 14
                  TimeBanner = &quot;Response Time&quot;
              Case Is &lt;= 3
                  TimeBanner = &quot;Refine and Improve&quot;
              Case Is &lt;= 1
                  TimeBanner = &quot;Submit&quot;
              Case Is = 0
                  TimeBanner = &quot;Time Up&quot;
              End Select
  End Select
  
  End Sub
  </code></pre>