+ Reply to Thread
Results 1 to 2 of 2

Search across multiple sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    06-03-2011
    Location
    Kent, England
    MS-Off Ver
    Excel 2003 / 2007
    Posts
    4

    Post Search across multiple sheets

    Hi everyone, I've only recently started using more advanced excel tools and I have come across a problem.

    The workbook contains lists of tools and their locations within a workshop. I am trying to create a search box which allows a part number to be searched for and the location is shown. I've got it working so that if the data in a cell is text or number then it works. But the problem comes because the book has several sheets which are all compiled into one (where the search function needs to be), and the part numbers are referenced to other sheets, for example, '='F Left'!C23'
    This is causing the search box to come up with no results, and I was wondering if there was a way to search across multiple sheets?

    Thanks in advance,

    Chris.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Search across multiple sheets

    I don't know if this will work for you but try:
    Sub SearchAcrossSheets()
        Dim ShtCnt As Long, ShtNum As Long
        Dim SearchStr As String
        Dim Found As Range
        ShtCnt = ActiveWorkbook.Sheets.Count
        SearchStr = InputBox("Please enter search criteria", "Search")
        For ShtNum = 1 To ShtCnt
            With Sheets(ShtNum)
                Set Found = .Cells.Find(SearchStr)
                If Not Found Is Nothing Then
                    '''Do what you want with it here'''
                End If
            End With
        Next ShtNum
    End Sub
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

+ 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