+ Reply to Thread
Results 1 to 2 of 2

Search Enggine with Criteria Between 2 date Using VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    03-10-2016
    Location
    england
    MS-Off Ver
    2010
    Posts
    1

    Search Enggine with Criteria Between 2 date Using VBA

    hello right now i was making a search enggine using VBA
    with sheet 1 as database and sheet 2 as search enggine i have code like this :

    my code is search enggine that search a data that contain an alphabet or number where the data being search,
    i still cant get it how to do it make a search enggine with criteria between 2 date
    so iam asking help now so, can anyone help me change this so that the criteria for searching is between 2 date

    Sub Search()
    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
    
    Sheet2.Range(Sheet2.Range("b9"), Sheet2.Range("b9").End(xlToRight).End(xlDown)).ClearContents
    sCol = Sheet2.Range("c2").Value
    Set rgFind = Sheet1.Range("a17:s17").Find(sCol, lookat:=xlWhole, MatchCase:=True)
    iCol = rgFind.Column
    lRow = Sheet1.Range("a17").CurrentRegion.Rows.Count
    vCrit = Sheet2.Range("c4").Value
    Set rgData = Sheet1.Range(Sheet1.Cells(18, iCol), Sheet1.Cells(lRow, iCol))
    For Each rgCell In rgData
    Set rgFind = rgCell.Find(vCrit, lookat:=xlPart, MatchCase:=False)
    If Not rgFind Is Nothing Then
    Sheet1.Range(Sheet1.Cells(rgCell.Row, 1), Sheet1.Cells(rgCell.Row, 19)).Copy
    Sheet2.Cells(Sheet2.Rows.Count, 2).End(xlUp).Offset(1).PasteSpecial xlPasteValuesAndNumberFormats
    Application.CutCopyMode = False
    End If
    Next rgCell
    Range("c4").Select
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Search Enggine with Criteria Between 2 date Using VBA

    This link explains the problems with searching for dates

    After reading it, have a go yourself first. If you are still struggling, reply attaching your workbook including some valid search data.
    thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Create User form to perform search using multiple search criteria
    By cherias in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-29-2015, 06:16 AM
  2. Replies: 4
    Last Post: 05-20-2014, 10:03 AM
  3. Replies: 2
    Last Post: 06-19-2013, 03:23 AM
  4. Search for duplicate entry on two criteria within date range
    By glynnhicks in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-22-2013, 06:00 AM
  5. [SOLVED] Index match formula to search for two criteria (date & name)
    By davechamp1983 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-17-2012, 10:00 PM
  6. Replies: 1
    Last Post: 10-18-2012, 05:52 AM
  7. Search all worksheets and paste all rows w/search criteria to single sheet
    By hutch@edge.net in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-22-2012, 01:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1