PDA

View Full Version : Trouble with code to grab data from multiple sheets and filter and list



FreeIndeed
01-07-2016, 11:40 AM
Hi there.
I am trying to set up a search function for my Workbook so that I can search data from every page in the workbook and then display the results on the original page (under the search bar.) I am working from an example and it works fine if all my data is on the page with the search feature. But, I can't figure out how to change the code so that it will search every page. I think the answer is in the code where it loads the sheet into a variable : Set sht = ActiveSheet
Can anyone help with what I would need to change to get it to load/search ALL sheets?
Thanks in advance!


15121

FreeIndeed
01-07-2016, 11:41 AM
Excel 2003 by the way!

Kevin#
01-11-2016, 04:04 AM
There are no macros visible in the attached file, presumably stored elsewhere.

You need to loop your "Search Codes" through all sheets in turn, adding results from successive sheets below your current results
something like:


For j = 1 To to Sheets.Count

'INSERT your "SearchCode" HERE , ensuring search ranges refer to sheet(j)

Sheets(j).Range("A:F") 'example

Next j


OR

For j = 1 To to Sheets.Count
'wrap code in With statement and use .range notation
With sheets(j)
'INSERT your "SearchCode" HERE, ensuring search ranges refer to sheet(j)
.Range("A:F") 'example
End With
Next j

FreeIndeed
01-11-2016, 07:19 AM
Thanks, I'll work with that!