HELP!!!! Search all Spreadsheets for data

nathan663

Board Regular
Joined
Dec 3, 2008
Messages
153
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?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
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
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,223,833
Messages
6,174,907
Members
452,590
Latest member
CraiginColorado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top