Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to quickly search a value in multiple sheets or workbooks?

Have you ever imaged to search a certain value in multiple sheets or workbooks in Excel? This tutorial introduces some different methods to solve the problems about searching in multiple sheets or searching in multiple workbooks.

Search a value in multiple sheets of a workbook with Find and Replace function

Search a value in all workbooks of a folder with VBA

Quickly search a value across multiple opened workbooks with Kutools for Excel good idea3


Find and replace value across sheets and workbooks

Kutools for Excel's advanced Find and Replace function, can help you find and replace a value across multiple sheets and opened workbooks.  Free Download
doc find across workbooks
 
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 60 days.

With Excel’s Find and Replace function, you can find a certain value across multiple sheets.

1. Select multiple sheet tabs you want to find value from by holding the Ctrl key and clicking the worksheets in the Sheet Tab bar one by one. See screenshot:

doc search value in multiple sheets 1

2. Then Press Ctrl + F to enable the Find and Replace window, and type the value you want to search in the Find what textbox under Find tab, and then click Find All button to list all the results. See screenshot:

doc search value in multiple sheets 2


If you want to search a value in all closed workbooks from a folder, you only can apply a VBA to solve it.

1. Enable a new workbook and select a cell, then press Alt + F11 keys to open Microsoft Visual for Basic Applications window.

2. Click Insert > Module and paste below VBA to the new Module window.

VBA: Search a value across all workbooks of a folder.

Sub SearchFolders()
'UpdatebyKutoolsforExcel20151202
    Dim xFso As Object
    Dim xFld As Object
    Dim xStrSearch As String
    Dim xStrPath As String
    Dim xStrFile As String
    Dim xOut As Worksheet
    Dim xWb As Workbook
    Dim xWk As Worksheet
    Dim xRow As Long
    Dim xFound As Range
    Dim xStrAddress As String
    Dim xFileDialog As FileDialog
    Dim xUpdate As Boolean
    Dim xCount As Long
    On Error GoTo ErrHandler
    Set xFileDialog = Application.FileDialog(msoFileDialogFolderPicker)
    xFileDialog.AllowMultiSelect = False
    xFileDialog.Title = "Select a forlder"
    If xFileDialog.Show = -1 Then
        xStrPath = xFileDialog.SelectedItems(1)
    End If
    If xStrPath = "" Then Exit Sub
    xStrSearch = "KTE"
    xUpdate = Application.ScreenUpdating
    Application.ScreenUpdating = False
    Set xOut = Worksheets.Add
    xRow = 1
    With xOut
        .Cells(xRow, 1) = "Workbook"
        .Cells(xRow, 2) = "Worksheet"
        .Cells(xRow, 3) = "Cell"
        .Cells(xRow, 4) = "Text in Cell"
        Set xFso = CreateObject("Scripting.FileSystemObject")
        Set xFld = xFso.GetFolder(xStrPath)
        xStrFile = Dir(xStrPath & "\*.xls*")
        Do While xStrFile <> ""
            Set xWb = Workbooks.Open(Filename:=xStrPath & "\" & xStrFile, UpdateLinks:=0, ReadOnly:=True, AddToMRU:=False)
            For Each xWk In xWb.Worksheets
                Set xFound = xWk.UsedRange.Find(xStrSearch)
                If Not xFound Is Nothing Then
                    xStrAddress = xFound.Address
                End If
                Do
                    If xFound Is Nothing Then
                        Exit Do
                    Else
                        xCount = xCount + 1
                        xRow = xRow + 1
                        .Cells(xRow, 1) = xWb.Name
                        .Cells(xRow, 2) = xWk.Name
                        .Cells(xRow, 3) = xFound.Address
                        .Cells(xRow, 4) = xFound.Value
                    End If
                    Set xFound = xWk.Cells.FindNext(After:=xFound)
                Loop While xStrAddress <> xFound.Address
            Next
            xWb.Close (False)
            xStrFile = Dir
        Loop
        .Columns("A:D").EntireColumn.AutoFit
    End With
    MsgBox xCount & "cells have been found", , "Kutools for Excel"
ExitHandler:
    Set xOut = Nothing
    Set xWk = Nothing
    Set xWb = Nothing
    Set xFld = Nothing
    Set xFso = Nothing
    Application.ScreenUpdating = xUpdate
    Exit Sub
ErrHandler:
    MsgBox Err.Description, vbExclamation
    Resume ExitHandler
End Sub

3. Then press F5 key or Run button to execute this VBA, and a Select a folder dialog pops out to remind you to select a folder which you want to search value from. See screenshot:

doc search value in multiple sheets 3

4. And then click OK and another dialog pops out to remind you the number of cells have been found. See screenshot:

doc search value in multiple sheets 4

5. Click OK to close it, and all the found cells are list in the current worksheet with the corresponding information.

doc search value in multiple sheets 5

Tip: In above VBA, you search the value “KTE”, and you can change “KTE” from this xStrSearch = "KTE" to another value as you need.


If you just want to search a value across multiple opened workbooks, you can use Kutools for Excel’s advanced Find and Replace utility.

Kutools for Excel, with more than 300 handy functions, makes your jobs more easier. 

After free installing Kutools for Excel, please do as below:

1. In one of the opened workbooks, click Kutools > Navigation, and then click the Find and Replace button doc find button to go to Find and Replace pane. See screenshot:

doc search value in multiple sheets 6

2. Then click Find tab, and type the value you want to search in the Find what textbox, and then select All workbooks from the Within dropdown list, and go to click Find All to list all found cells. See screenshot:

doc search value in multiple sheets 7

Tip:

With Kutools for Excel’s advanced Find and Replace utility, you can search and replace value in selected sheets across multiple workbooks, all workbooks, active workbook, active sheet or selection.

doc search value in multiple sheets 8


Tabbed browsing & editing multiple Word documents/Excel workbooks as Firefox, Chrome, Internet Explore 10!

You may be familiar to view multiple webpages in Firefox/Chrome/IE, and switch between them by clicking corresponding tabs easily. Here, Office Tab supports similar processing, which allow you to browse multiple Word documents or Excel workbooks in one Word window or Excel window, and easily switch between them by clicking their tabs.
Click for free trial of Office Tab!

Browse multiple word documents in one window as Firefox

Relative Articles:


Excel Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 70%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 80% Excel problems.

  • Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  • Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  • Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  • Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  • No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  • Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  • 60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  • Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    MM · 6 months ago
    Awesome this works perfect,
    Could you help me, I would like to create an hyperlink to each cell where the value was found.

    Thanks in advance
  • To post as a guest, your comment is unpublished.
    James · 9 months ago
    Perfect for what I need except for the fact that it creates a new sheet every search. How would I modify the code to use a single sheet for each search instead of creating a new one? Thanks, James
  • To post as a guest, your comment is unpublished.
    Ray · 10 months ago
    Your code works great, I look for a code that finds two texts in excel files, do you know how is it possible?
  • To post as a guest, your comment is unpublished.
    Matt Sabin · 1 years ago
    How can I add another column and bring the value that is always 3 columns to the right on the value found?
  • To post as a guest, your comment is unpublished.
    André · 1 years ago
    Thanks. It helped me a lot =)