Results 1 to 4 of 4

HELP!!!! Search all Spreadsheets for data

This is a discussion on HELP!!!! Search all Spreadsheets for data within the Excel Questions forums, part of the Question Forums category; I have multiple Spreadsheets, all with the same lay out but with different data in the cells, (Different answers for ...

  1. #1
    Board Regular
    Join Date
    Dec 2008
    Posts
    152

    Default HELP!!!! Search all Spreadsheets for data

    I have multiple Spreadsheets, all with the same lay out but with different data in the cells, (Different answers for different Spreadsheets) Is it possible to search through every one of these and pull out each Spread sheet or provide a list of the spreadsheets with a country in a certain cell (for example), i would have a few different criteria i would be searching for?

    For example if i wanted a list of All Spreadsheets with United Kingdom in Cell B3, would this be possible?

  2. #2

    Join Date
    Feb 2003
    Location
    Gurgaon/Thrissur
    Posts
    2,615

    Default Re: HELP!!!! Search all Spreadsheets for data

    Hi,

    Code:
    Sub kTest()
    Dim i   As Long, txt As String, SearchStr As String
    
    SearchStr = Application.InputBox("Enter Search Value", "Search all sheets", Type:=2)
    
    If SearchStr <> "False" Then
        For i = 1 To Worksheets.Count
            If UCase(Sheets(i).Range("B3")) = UCase(SearchStr) Then
                txt = txt & vbCrLf & Sheets(i).Name
            End If
        Next
        If Len(txt) > 1 Then
            txt = Mid$(txt, 2)
            MsgBox txt
        End If
    End If
    End Sub
    HTH

  3. #3
    Board Regular
    Join Date
    Dec 2008
    Posts
    152

    Default Re: HELP!!!! Search all Spreadsheets for data

    thank you for this, one question, can you explain what it does/how to work it?

    I am not to good with this side of excel

  4. #4

    Join Date
    Feb 2003
    Location
    Gurgaon/Thrissur
    Posts
    2,615

    Default Re: HELP!!!! Search all Spreadsheets for data

    Hi,

    Hit Alt+F11 > Go to insert > module > paste this code on the right side. Close the window.

    Now goto tools > macro > macros > select kTest and click on Run.


    Here is a tutorial on Excel macros

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com