title: Search Engine with Criteria Between 2 date Using VBA
body: <p>i try to make a search enggine using vba excel and found a code like this </p>
  
  <pre><code>Sub Search1()
      Dim sCol As String
      Dim rgFind As Range, rgData As Range, rgCell As Range
      Dim iCol As Integer
      Dim lRow As Long
      Dim vCrit As Variant
  
      Range(Range("m8"), Range("m8").End(xlToRight).End(xlDown)).ClearContents
      sCol = Range("n3").Value
      Set rgFind = Range("a2:j2").Find(sCol, lookat:=xlWhole, MatchCase:=True)
      iCol = rgFind.Column
      lRow = Range("a2").CurrentRegion.Rows.Count
      vCrit = Range("n5").Value
      Set rgData = Range(Cells(3, iCol), Cells(lRow, iCol))
      For Each rgCell In rgData
          Set rgFind = rgCell.Find(vCrit, lookat:=xlPart, MatchCase:=False)
          If Not rgFind Is Nothing Then
              Range(Cells(rgCell.Row, 1), Cells(rgCell.Row, 10)).Copy
              Cells(Rows.Count, 13).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
              Application.CutCopyMode = False
          End If
      Next rgCell
      Range("n5").Select 
  End Sub
  </code></pre>
  
  <p>but this script only search data that contain alphabet and number on field that i was search.</p>
  
  <p>but i want to search data between 2 date. i choose the field i want to search ( field with date data ) and search the data between 2 date.</p>
  
  <p>here the file 
  <a href="https://mega.nz/#!y5ZHFKIY!OpHpyKuorC0iHVlOGZW0g-qXfNAv9GxL0wyBpN45sLE" rel="nofollow">https://mega.nz/#!y5ZHFKIY!OpHpyKuorC0iHVlOGZW0g-qXfNAv9GxL0wyBpN45sLE</a></p>
  
  <p>i already try to change the script using</p>
  
  <pre><code>rSearch = Sheet1.Range("B3", Sheet1.Range("B" &amp; Rows.Count).End(xlUp))
  'search data in range B3 - B (contain data date) and then using change the if 
  if rSearch &gt;= Date1 Or rSearch &lt;= Date2
  </code></pre>
  
  <p>but got error type mismatch or something 
  can someone help me so i can search the data between 2 date 
  thanks before</p>