+ Reply to Thread
Results 1 to 21 of 21

Search Multiple Columns and Rows - Show results in Multiple columns and rows

  1. #1
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Search Multiple Columns and Rows - Show results in Multiple columns and rows

    I need some help with a project. I`m trying create a searchable spreadsheet that will search multiple columns and rows from one sheet and return matched data to another sheet. - For example Search the term "Vang" and everything associated with that key search is returned (Columns a-m) is this possible?
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Please Login or Register  to view this content.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    I added that but I think I messed up, its returning information from the data sheets in columns c-m .....also i`d like to have it show all rows of a product.
    Attached Files Attached Files

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Looks like it fills in just fine.

    Make sure you change the assigned macro to the button to my macro and not what you already have coded in the book.

  5. #5
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Clearly i`m an idiot, when I open the workbook- enable micros and run a search it will A) Only search keywords in Column B on the data page B) will only display data for C-M once and stay static regardless of what other key words I search for. C) not sure how to properly assign the micros to stay.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Still not sure why the updated KYKY macro wont run every time I enter a search term
    Attached Files Attached Files

  7. #7
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    I checked the button and it wasn't attached to the macro. You need to assign it.


    I've added a new workbook with the button removed, so the macro runs when you change B2, and with code to clear the area each time.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Its only returning data from Data sheet B:2 Thru M:2

  9. #9
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    For what search result? Every search I've typed in has refreshed the correct amount of data.

  10. #10
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Hi daffodil11,
    . Sorry if I am talking rubbish.. ... I had noted this thread as one to answer, but you beat me to it.. So I thought I would steal your code anyway...
    . I could not get it to work either. I was very confused how you were referencing your ranges -- ( Looked like the way Rory usually moans at me for if I do it that way in threads.. ).
    . So I “over did it “ a bit -- - referencing the ranges fully, like in the code below, and then I got your code to work..
    .
    . I expect your code works as well in the form you have it, but I am implementing it wrong or there is something else more subtle about the way you are referencing the ranges that i do not know about yet??. Can you enlighten me?
    Thanks

    Code that works for me:

    Please Login or Register  to view this content.
    Alan
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

  11. #11
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Alan,
    could you attach a file to show this your way?

  12. #12
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    The code in the most recent workbook features a Worksheet_Change event, so all sheet references are implied to the sheet the code is imbedded on.

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Its still not returning the correct data.

  14. #14
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    See Attached- example search Jackson - it doesnt return correct
    Attached Files Attached Files

  15. #15
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Hi, Thanks for the reply, appreciate it..

    Quote Originally Posted by daffodil11 View Post
    The code in the most recent workbook features a Worksheet_Change event, so all sheet references are implied to the sheet the code is imbedded on.....
    .. I think I get that.. but this bit (In both your codes ) is still confusing me

    .Range("A" & i, Sheets("Data").Range("M" & i))

    Alan

    ...... accepting the bit about inmplicitly referencing the sheet in which the code is in, I would expect i t to look lkie this


    Sheets("Data").Range(Sheets("Data").Range("A" & i), Sheets("Data").Range("M" & i)),

    or if you were referencing the search sheet ( you are not ) then it would look like ( i thought)

    .Range ( .Range("A" & i) , .Range("M" & i))
    Last edited by Doc.AElstein; 08-11-2015 at 04:58 PM.

  16. #16
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Quote Originally Posted by heykeighley View Post
    Alan,
    could you attach a file to show this your way?
    .. I posted the code that works for me with your file in post #10, but wait to see what daffodil11 says, I may have missed something subtle ( he has a much better idea then I do )

  17. #17
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    You certainly can use: Range(Range("a1"),Range(xx))

    However, this works just as well: Range("a1",Range("xx")).

    I went through the code and applied explicit references throughout and found it included a few line of Data that were previously being omitted, particularly when searching for "RIA" it was skipping that Contract.

    Please Login or Register  to view this content.
    The code logic:

    First it clears the paste-to area
    Next, it looks at each line of Data
    Of each line, it looks at each cell in each line. If a single cell contains the Search parameter of B2, it stops searching, and copies the line over
    It then resumes with the next line
    Last edited by daffodil11; 08-11-2015 at 05:17 PM.

  18. #18
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Quote Originally Posted by daffodil11 View Post
    You certainly can use: Range(Range("a1"),Range(xx))

    However, this works just as well: Range("a1",Range("xx")).

    .....
    .. Thanks I have learnt something there, .I did not know you could do that.

    Alan

    P.s. I think , though, the original problem is that the other code of yours were referrencing the search sheet and not the data sheet. ( - as you rightly said the code was in search sheet, so implicitly you were referrencing that ) ....Which you have corrected with

    wsData.Range("A" & i, wsData.Range("M" & i))
    Last edited by Doc.AElstein; 08-11-2015 at 05:28 PM.

  19. #19
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Yeah, sorry guys. I'm a sloppy coder. I hear you get better with practice.

  20. #20
    Registered User
    Join Date
    08-06-2015
    Location
    Louisville
    MS-Off Ver
    8
    Posts
    9

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    So is there an updated sheet that searches A thru M and returns any keyword hit? essentially this should act like a database.

  21. #21
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Search Multiple Columns and Rows - Show results in Multiple columns and rows

    Quote Originally Posted by heykeighley View Post
    So is there an updated sheet that searches A thru M and returns any keyword hit? essentially this should act like a database.
    What ???

    Do you still need help,in getting daffodil11's latest code working??

    Alan

+ 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: 6
    Last Post: 08-22-2014, 08:47 AM
  2. [SOLVED] VBA code to search multiple columns and delete any duplicate cells (not rows)
    By philmurp in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-16-2014, 03:27 PM
  3. Replies: 3
    Last Post: 01-21-2014, 05:15 PM
  4. Replies: 9
    Last Post: 12-15-2013, 10:05 PM
  5. search multiple columns and count number of rows the keywords appear
    By vincegc8 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-22-2013, 02:01 PM
  6. Search Multiple Columns and Rows and Return Row
    By rplute in forum Excel General
    Replies: 4
    Last Post: 02-21-2011, 10:58 PM
  7. Replies: 5
    Last Post: 08-16-2006, 02:05 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