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


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


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
find replace
 
Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days.

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 buttonto 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 kutools find replace 2

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 kutools find replace 3


Relative Articles:


The Best Office Productivity Tools

Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial. 60-day money back guarantee.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
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.
    Shree · 3 months ago
    How do i create hyperlink under column C for all cell values in the same code?
  • To post as a guest, your comment is unpublished.
    Rafael · 1 years ago
    como generar códigos qr
  • To post as a guest, your comment is unpublished.
    MM · 1 years 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.
      chan · 1 years ago
      me too I would like! :)
  • To post as a guest, your comment is unpublished.
    James · 2 years 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 · 2 years 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.
      Sunny · 2 years ago
      Sorry, I have no idea on this problem, you can go to our forum https://www.extendoffice.com/forum.html to carry on the problem, maybe someone know the answer.
  • To post as a guest, your comment is unpublished.
    sabinsolutions@gmail.com · 2 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.
      Sunny · 2 years ago
      Sorry I cannot help you, you can go to out forum https://www.extendoffice.com/forum.html to carry on the question, maybe someone can help you.
  • To post as a guest, your comment is unpublished.
    André · 2 years ago
    Thanks. It helped me a lot =)
  • To post as a guest, your comment is unpublished.
    Orlando B · 2 years ago
    This is what i want it to return "Site Instruction" which is allocated to all Text in Cell
    Workbook Worksheet Cell Text in Cell Site Instruction
    Shift report Emicc 01-10-17.xlsx Sheet1 $D$20 CMS install 1773
    Shift report Emicc 01-10-17.xlsx Sheet1 $D$21 CMS install 1763
    Shift report Emicc 01-10-17.xlsx Sheet1 $D$24 CMS install 1551
  • To post as a guest, your comment is unpublished.
    Orlando B · 2 years ago
    Thanks for that VBA, it works perfectly to search multiple excel files, however it is possible to get it to return a 5th Column with Reference number? 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
    .Cells(xRow, 5) = ???
  • To post as a guest, your comment is unpublished.
    Orly B · 2 years ago
    Thanks for that VBA, it works perfectly to search multiple excel files, however it is possible to get it to return a 5th Column with Reference number? 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
    .Cells(xRow, 5) = ???