+ Reply to Thread
Results 1 to 6 of 6

Help expanding the search criteria on an existing macro

  1. #1
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Help expanding the search criteria on an existing macro

    Hi all,

    I'm looking for some assistance in modifying a macro to expand what it's searching for/returning.

    I have data in about 150 worksheets within a workbook, within each worksheet there are certain keywords that I'm searching for (Employee ID being the first, with cost centre and location also being required.

    The following code will search through all sheets looking for Employee ID, provided some text is in at least column A it will copy the row across to a separate sheet (summary tab) along with the sheet name being dropped into column O.

    Please Login or Register  to view this content.
    I'm looking for help in doing two things:

    1. Expanding the search criteria to include more than one text string (3 or 4 would be ideal)
    2. Understanding what happens when the data doesn't start in column A (as the results are intermittent).

    I've attached sample workbook showing how it works.Searching for Text.xlsm

    Any help would be appreciated.

    Cheers

    David

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Help expanding the search criteria on an existing macro

    I have amended the code on module 2.
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Help expanding the search criteria on an existing macro

    Hi AB33,

    Thanks very much for modifying the code, I have a copule of questions:

    For some reason if I put "location" in F10 and number in F11 of Sheet 5 this isn't picked up and returned by the macro (any idea why?), also the summary sheet appear to have duplicates of the data from sheets 2,3,4, but sheet 5 is only displayed once.

    Any idea why?

    Thanks

    David

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Help expanding the search criteria on an existing macro

    Hmm?
    Use this line

    Please Login or Register  to view this content.
    Instead of

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by AB33; 09-17-2014 at 07:41 AM.

  5. #5
    Forum Contributor
    Join Date
    05-04-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    125

    Re: Help expanding the search criteria on an existing macro

    Hi AB33,

    Thanks - that's fixed the duplicates in the summary tab.

    Any idea how I can return one of the text strings if it starts in Column B or to the left of Column A?

    Thanks

    Dave

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Help expanding the search criteria on an existing macro

    The code is searching in all columns. If you want to search in column A ONLY

    With ws.columns("A")

+ 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. Expanding Search Engine in Macro Excel
    By UWS2012 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-07-2013, 05:38 PM
  2. Linking Search Results from an existing search macro
    By mougiasm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2013, 04:15 PM
  3. Expanding on existing VBA code
    By gss in forum Excel General
    Replies: 1
    Last Post: 09-13-2010, 02:19 PM
  4. Expanding existing macro
    By Sir08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-29-2009, 02:52 PM
  5. Help amending existing marco for a criteria search on a database
    By howardjo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2008, 07:01 AM

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