メインコンテンツへスキップ

複数のシートまたはワークブックで値をすばやく検索するにはどうすればよいですか?

Excelで複数のシートまたはワークブックの特定の値を検索するためにイメージしたことがありますか? このチュートリアルでは、複数のシートでの検索や複数のワークブックでの検索に関する問題を解決するためのいくつかの異なる方法を紹介します。

検索と置換機能を使用して、ワークブックの複数のシートで値を検索します

VBAを使用してフォルダーのすべてのブックの値を検索する

Kutools for Excelを使用して、開いている複数のブック全体の値をすばやく検索する 良いアイデア3


Excelの 検索および置換 関数、あなたは複数のシートにわたって特定の値を見つけることができます。

1.を押したままにして、値を検索する複数のシートタブを選択します。 Ctrlキー キーを押して、のワークシートをクリックします シートタブバー 一つずつ。 スクリーンショットを参照してください:

複数のシートのドキュメント検索値1

2.次にを押します Ctrl + F を有効にする 検索および置換 ウィンドウで、検索する値を 見つける 下のテキストボックス もう完成させ、ワークスペースに掲示しましたか? タブ、[OK]をクリックします すべて検索 ボタンをクリックして、すべての結果を一覧表示します。 スクリーンショットを参照してください:

複数のシートのドキュメント検索値2


シートやワークブック全体で価値を見つけて置き換える

Kutools for Excelの高度な 検索および置換 関数は、複数のシートや開いているブック全体で値を見つけて置き換えるのに役立ちます。  無料ダウンロード
置換を見つける
 
Kutools for Excel:300を超える便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。

フォルダから閉じたすべてのブックの値を検索する場合は、VBAを適用して解決することしかできません。

1.新しいブックを有効にしてセルを選択し、を押します Altキー+ F11 開くキー 基本的なアプリケーションのためのMicrosoftVisual 窓。

2。 クリック インセット > モジュール VBAの下を新しいモジュールウィンドウに貼り付けます。

VBA:フォルダーのすべてのブックで値を検索します。

Sub SearchFolders()
'UpdatebyKutoolsforExcel20200913
    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
    Dim xAWB As Workbook
    Dim xAWBStrPath As String
    Dim xBol As Boolean
    Set xAWB = ActiveWorkbook
    xAWBStrPath = xAWB.Path & "\" & xAWB.Name
    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 <> ""
            xBol = False
            If (xStrPath & "\" & xStrFile) = xAWBStrPath Then
                xBol = True
                Set xWb = xAWB
            Else
                Set xWb = Workbooks.Open(Filename:=xStrPath & "\" & xStrFile, UpdateLinks:=0, ReadOnly:=True, AddToMRU:=False)
            End If
            For Each xWk In xWb.Worksheets
                If xBol And (xWk.Name = .Name) Then
                Else
                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
                End If
            Next
            If Not xBol Then
            xWb.Close (False)
            End If
            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.次にを押します F5 キーまたは ラン このVBAを実行するためのボタン、および フォルダを選択 ダイアログがポップアップ表示され、値を検索するフォルダを選択するように通知されます。 スクリーンショットを参照してください:

複数のシートのドキュメント検索値3

4.次に、をクリックします OK セルの数が見つかったことを通知する別のダイアログが表示されます。 スクリーンショットを参照してください:

複数のシートのドキュメント検索値4

5。 クリック OK 〜へ 閉じる 見つかったすべてのセルが、対応する情報とともに現在のワークシートに一覧表示されます。

複数のシートのドキュメント検索値5

ヒント: 上記のVBAで、値を検索します 「KTE」、そしてあなたは変えることができます 「KTE」 これから xStrSearch = "KTE" 必要に応じて別の値に変更します。


開いている複数のワークブック全体で値を検索するだけの場合は、次を使用できます。 Kutools for Excel 's高度 検索および置換 ユーティリティ。

Kutools for Excel, 以上で 300 便利な機能は、あなたの仕事をより簡単にします。 

無料インストール Kutools for Excel、以下のようにしてください:

1.開いているワークブックのXNUMXつで、をクリックします クツール > ナビゲーション、をクリックします。 検索および置換 (Comma Separated Values) ボタンをクリックして、各々のジョブ実行の詳細(開始/停止時間、変数値など)のCSVファイルをダウンロードします。 ドキュメント検索ボタン を選択して 検索および置換 ペイン。 スクリーンショットを参照してください:

複数のシートのドキュメント検索値6

2。 次に、をクリックします もう完成させ、ワークスペースに掲示しましたか? タブをクリックし、検索する値を 見つける テキストボックスをクリックして、 すべてのワークブック 中で ドロップダウンリストをクリックして、 すべて検索 見つかったすべてのセルを一覧表示します。 スクリーンショットを参照してください:
doc kutools 検索置換 2

ヒント:

Kutools for Excelの高度な 検索および置換 ユーティリティを使用すると、複数のワークブック、すべてのワークブック、アクティブなワークブック、アクティブなシート、または選択範囲にわたって、選択したシートの値を検索して置き換えることができます。
doc kutools 検索置換 3


関連記事:

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (18)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
program stops here:

Set xWb = Workbooks.Open(Filename:=xStrPath & "\" & xStrFile, UpdateLinks:=0, ReadOnly:=True, AddToMRU:=False)
This comment was minimized by the moderator on the site
Hi, Mike, I have update the VBA in the article, please try again. If there is any problem, please let me know, thank you.
This comment was minimized by the moderator on the site
HI in my case worksheet with more than 1 Lakhs record, scripts failed.
This comment was minimized by the moderator on the site
Hi, Dhireesh, VBA code has its own limitation. You could try Kutools for Excel's Fiind and Replace, but it may run slowly, please be patience, and had better save the workbooks before.
This comment was minimized by the moderator on the site
How do i create hyperlink under column C for all cell values in the same code?
This comment was minimized by the moderator on the site
como generar códigos qr
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
me too I would like! :)
This comment was minimized by the moderator on the site
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
This comment was minimized by the moderator on the site
Your code works great, I look for a code that finds two texts in excel files, do you know how is it possible?
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
How can I add another column and bring the value that is always 3 columns to the right on the value found?
This comment was minimized by the moderator on the site
Did you ever figure this out? I need that as well.
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
Thanks. It helped me a lot =)
This comment was minimized by the moderator on the site
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
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations