+ Reply to Thread
Results 1 to 8 of 8

Find and Display results VBA Code - Loop to find all Matches

  1. #1
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Find and Display results VBA Code - Loop to find all Matches

    I need VBA code that would search for a Area and give me all zip associated with it.

    Rawdata Sheet has 2 columns

    Area Zip
    1 18240
    1 18250
    1 18252
    1 18706
    2 18229
    2 18235
    2 18250
    3 18030
    3 18058
    3 18071
    4 18079
    4 18080

    User enters in Sheet 2

    Area
    1
    2
    3
    4


    Results are displayed in Sheet3

    Area Zip
    1 18240
    1 18250
    1 18252
    1 18706
    2 18229
    2 18235
    2 18250
    3 18030
    3 18058
    3 18071
    4 18079
    4 18080

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: Find and Display results VBA Code - Loop to find all Matches

    what is difference between sheet 1 and sheet 3?
    I am not an expert. better solutions may be available
    [email protected]

  3. #3
    Forum Contributor lancer102rus's Avatar
    Join Date
    04-02-2014
    Location
    Ufa
    MS-Off Ver
    Excel 2010, 2013
    Posts
    252

    Re: Find and Display results VBA Code - Loop to find all Matches

    Why don`t you use filter?

  4. #4
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Find and Display results VBA Code - Loop to find all Matches

    Quote Originally Posted by venkat1926 View Post
    what is difference between sheet 1 and sheet 3?
    Sheet 3 is the result page and sheet 1 is the raw data




    For example if I enter in sheet2

    Column A
    Area
    2
    4

    then the results will be entered in sheet 3 as

    Area Zip
    2 18229
    2 18235
    2 18250
    4 18079
    4 18080

    All possible matches based on Area(Column A) on Sheet2 from the rawdata sheet.

  5. #5
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Find and Display results VBA Code - Loop to find all Matches

    Quote Originally Posted by lancer102rus View Post
    Why don`t you use filter?

    I have too many areas to filter for which is why VBA code will be helpful and a lot quicker.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find and Display results VBA Code - Loop to find all Matches

    Event code for Sheet2

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-11-2014
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: Find and Display results VBA Code - Loop to find all Matches

    Thanks, Can this be done via a Macro instead of an Event code?

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Find and Display results VBA Code - Loop to find all Matches

    Maybe:

    Please Login or Register  to view this content.

+ 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. Replies: 5
    Last Post: 08-17-2014, 09:51 PM
  2. [SOLVED] Find Exact matches on 2 sheets and export results to 3rd Sheet
    By gadrummer65 in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 05-27-2014, 01:41 PM
  3. Put Find code in Loop to find all matches
    By SarahPintal in forum Excel General
    Replies: 4
    Last Post: 02-08-2010, 09:05 PM
  4. Find matches in two worksheets - outputs results to new column
    By Always Confused in forum Excel General
    Replies: 5
    Last Post: 02-16-2009, 08:51 AM
  5. If/Then Loop to find Matches in Column
    By Engineers08 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-05-2008, 05:10 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