title: How to fetch only selected date's data from a website using VBA code?
body: <p>I have crawled a website (mentioned in the code), using VAB, and stored the data in an excel file. My user form has an option button to "select today's data". Accordingly, I am trying to modify the following code for the same. Will you please help me? I tried several options but unable to achieve what I want.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>Public Sub Extract_TD_text()
  
  Dim URL As String
  Dim IE As InternetExplorer
  Dim HTMLdoc As HTMLDocument
  Dim TRelements As IHTMLElementCollection
  Dim TRelement As HTMLTableCell
  
  Dim r As Long
  Dim i As Long
  Dim offSet As Integer
  Dim maxOffSet As Integer
  Dim currentDate As Date
  
  URL = "https://www.gebiz.gov.sg/scripts/main.do?sourceLocation=openarea&amp;select=tenderId"
  Sheet1.Cells.ClearContents
  Set IE = New InternetExplorer
  offSet = 0
  r = 0
  k = 0
  
  If UserForm1.OptionButton1.Value = True Then
  cuerrentDate = Date
  
  With IE
      .navigate URL
      .Visible = True
       'Wait for page to load
      While .Busy Or .readyState &lt;&gt; READYSTATE_COMPLETE: DoEvents: Wend
      Set InputElements = .document.getElementsByTagName("input")
      For Each InputElement In InputElements
          If InputElement.getAttribute("name") = "strBtnLast" Then
              maxOffSet = CInt(Split(Split(InputElement.getAttribute("onclick"), "Navigator(")(1), ")")(0))
          End If
      Next
      While offSet &lt;= maxOffSet
          offSet = offSet + 10
          Set TRelements = .document.getElementsByTagName("tr")
          For Each TRelement In TRelements
           'Look for required TD elements - this check is specific to VBA Express forum - modify as required
              If TRelement.className = "row_even" Or TRelement.className = "row_odd" Or TRelement.className = "header_subone" Then
                  i = 0
                  For Each Child In TRelement.ChildNodes
                      Sheet1.Range("A1").offSet(r, i).Value = Child.innerText
                      i = i + 1
                  Next
                  r = r + 1
              End If
          Next
          If offSet &lt;= 10 Then
              Sheet1.Rows(1).Delete
              Sheet1.Rows(1).Delete
              r = r - 2
          End If
          If offSet &gt; 10 Then
              Sheet1.Rows(offSet - 8).Delete
              Sheet1.Rows(offSet - 8).Delete
              Sheet1.Rows(offSet - 8).Delete
              r = r - 3
          End If
          .document.parentWindow.execScript "submitHTMLTableNavigator(" + CStr(offSet) + ");"
          While .Busy Or .readyState &lt;&gt; READYSTATE_COMPLETE: DoEvents: Wend
      Wend
      'Sheet1.Range("A:F").WrapText = False
      IE.Quit
  End With
  End If
  End Sub
  </code></pre>
  
  <p>Looking forward for someone to help me here.
  Thanking you in advance.</p>
  
  <p>Cheers.</p>