title: Looped Timer in Excel VBA code
body: <p>I am new to VBA and am trying to learn some of the functionality.  What I have created is a code in excel that connects to an API and pulls data into a table.  I need it to loop for a specified period of time (9am to 4pm) and refresh every 30 seconds.  My problem is I just don't know how to accomplish this.  Here is my code Please help!  Thanks!!</p>
  
  <p>Also the table being populated is setup in the following Columns: "Symbol" "Name" "Ask" "Bid" "Price" "Days Range" "1yr Target Price" "Volume" "Avg Daily Vol"</p>
  
  <p>My Code:</p>
  
  <pre><code>Private Sub BTN_Start_Click()
      Dim W As Worksheet: Set W = ActiveSheet
      Dim Last As Integer: Last = W.Range("A10000").End(xlUp).Row
      If Last = 1 Then Exit Sub
      Dim Symbol As String
      Dim i As Integer
      For i = 2 To Last
          Symbol = Symbol &amp; W.Range("A" &amp; i).Value &amp; "+"
      Next i
      Symbol = Left(Symbol, Len(Symbol) - 1)
  
  
  
      Dim url As String: url = "http://finance.yahoo.com/d/quotes.cvs?s=" &amp; Symbol &amp; "&amp;f=snb2b3k1m2t8va2"
      Dim Http As New winhttprequest
      Http.Open "GET", url, False
      Http.send
  
      Dim Resp As String: Resp = Http.ResponseText
      Dim Lines As Variant: Lines = Split(Resp, vbNewLine)
      Dim sLine As String
      Dim Values As Variant
      For i = 0 To UBound(Lines)
          sLine = Lines(i)
  
          If InStr(sLine, ",") &gt; 0 Then
              Values = Split(sLine, ",")
              W.Cells(i + 2, 2).Value = Split(Split(sLine, Chr(34) &amp; "," &amp; Chr(34))(1), Chr(34))(0)
              W.Cells(i + 2, 3).Value = Values(UBound(Values) - 6)
              W.Cells(i + 2, 4).Value = Values(UBound(Values) - 5)
              W.Cells(i + 2, 5).Value = Values(UBound(Values) - 4)
              W.Cells(i + 2, 6).Value = Values(UBound(Values) - 3)
              W.Cells(i + 2, 7).Value = Values(UBound(Values) - 2)
              W.Cells(i + 2, 8).Value = Values(UBound(Values) - 1)
              W.Cells(i + 2, 9).Value = Values(UBound(Values))
  
  
          End If
      Next i
      W.Cells.Columns.AutoFit
  
  End Sub
  </code></pre>