+ Reply to Thread
Results 1 to 5 of 5

Using a Macro to search though a database and display the results on a new sheet

  1. #1
    Registered User
    Join Date
    02-05-2013
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Smile Using a Macro to search though a database and display the results on a new sheet

    Hi everyone! I'm so glad I found this forum as I am very new to Excel macros and I'm trying to create something that will help me and my company.

    The below thread talks about something very similar to what I am trying to do:

    http://www.excelforum.com/excel-prog...-userform.html

    I have a 9 column, thousands-of-rows data file and I am trying to pull information from. What I would like to do:

    *enter a string (i.e. 'gk') to be searched for in column B
    * enter a date range, where the dates are in column D, that you want to filter (i.e. start date 1/1/13, end date 1/31/13
    *display all columns in that row that contains the above criteria, on to a new sheet (i.e. I would like the entire row that contains 'gk' in column B and a date from column D within the range entered)

    The link above is very close to what I am looking for, except it a)doesnt have a date range and b) it displays results in a userform rather than a new sheet.

    Any help would be greatly appreciated!! Once I see the code for it, I can learn off of that to do other things.

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Using a Macro to search though a database and display the results on a new sheet

    here is a quick and dirty macro that would do it:
    Please Login or Register  to view this content.
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  3. #3
    Registered User
    Join Date
    02-05-2013
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Using a Macro to search though a database and display the results on a new sheet

    Thanks Pierre! I'm running this and it is giving me the error: "Run time error 1004 autofilter method of range class failed". I am trying to fix this but am having no luck. Is there something I am overlooking?

  4. #4
    Registered User
    Join Date
    02-05-2013
    Location
    Austin, TX
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Using a Macro to search though a database and display the results on a new sheet

    Thanks Pierre! I'm running this and it is giving me the error: "Run time error 1004 autofilter method of range class failed". I am trying to fix this but am having no luck. Is there something I am overlooking?

  5. #5
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Using a Macro to search though a database and display the results on a new sheet

    it might be the way you enter your date in the input boxes. It has to do with your system setup.
    There are lots of way for date format: 2013-01-25 or 2013/01/25 or 01/25/2013 etc.
    Try to run the macro step by step and see where it bugs.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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