ไปยังเนื้อหาหลัก

วิธีค้นหาค่าในแผ่นงานหรือสมุดงานหลายแผ่นอย่างรวดเร็ว

คุณเคยถ่ายภาพเพื่อค้นหาค่าบางอย่างในแผ่นงานหรือสมุดงานใน Excel หรือไม่? บทช่วยสอนนี้แนะนำวิธีการต่างๆในการแก้ปัญหาเกี่ยวกับการค้นหาในแผ่นงานหลายแผ่นหรือค้นหาในสมุดงานหลายเล่ม

ค้นหาค่าในแผ่นงานหลายแผ่นด้วยฟังก์ชันค้นหาและแทนที่

ค้นหาค่าในสมุดงานทั้งหมดของโฟลเดอร์ด้วย VBA

ค้นหาค่าอย่างรวดเร็วในสมุดงานที่เปิดไว้หลายเล่มด้วย Kutools for Excel ความคิดที่ดี 3


ด้วย Excel's ค้นหาและแทนที่ คุณสามารถค้นหาค่าที่แน่นอนในหลายแผ่นงาน

1. เลือกแท็บแผ่นงานหลายแผ่นที่คุณต้องการค้นหาค่าโดยกดปุ่ม Ctrl คีย์และคลิกเวิร์กชีตในไฟล์ แถบแท็บแผ่นงาน ทีละคน. ดูภาพหน้าจอ:

ค่าการค้นหา doc ในหลายแผ่น 1

2. จากนั้นกด Ctrl + F เพื่อเปิดใช้งาน ค้นหาและแทนที่ หน้าต่างแล้วพิมพ์ค่าที่คุณต้องการค้นหาในไฟล์ สิ่งที่ค้นหา ช่องข้อความภายใต้ หา จากนั้นคลิกที่ ค้นหาทั้งหมด ปุ่มเพื่อแสดงผลลัพธ์ทั้งหมด ดูภาพหน้าจอ:

ค่าการค้นหา doc ในหลายแผ่น 2


ค้นหาและแทนที่ค่าในแผ่นงานและสมุดงาน

Kutools สำหรับ Excelขั้นสูง ค้นหาและแทนที่ ฟังก์ชันสามารถช่วยคุณค้นหาและแทนที่ค่าในแผ่นงานหลายแผ่นและสมุดงานที่เปิดอยู่  ดาวน์โหลดฟรี
ค้นหาแทนที่
 
Kutools for Excel: มีโปรแกรมเสริม Excel ที่มีประโยชน์มากกว่า 300 รายการให้ทดลองใช้ฟรีโดยไม่มีข้อ จำกัด ใน 30 วัน

หากคุณต้องการค้นหาค่าในสมุดงานที่ปิดทั้งหมดจากโฟลเดอร์คุณสามารถใช้ VBA เพื่อแก้ปัญหาได้เท่านั้น

1. เปิดใช้งานสมุดงานใหม่และเลือกเซลล์จากนั้นกด Alt + F11 กุญแจเพื่อเปิด Microsoft Visual สำหรับแอปพลิเคชันพื้นฐาน หน้าต่าง

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 นี้และปุ่ม เลือกโฟลเดอร์ กล่องโต้ตอบจะปรากฏขึ้นเพื่อเตือนให้คุณเลือกโฟลเดอร์ที่คุณต้องการค้นหาค่า ดูภาพหน้าจอ:

ค่าการค้นหา doc ในหลายแผ่น 3

4. จากนั้นคลิก OK และอีกกล่องโต้ตอบจะปรากฏขึ้นเพื่อเตือนให้คุณทราบจำนวนเซลล์ที่พบ ดูภาพหน้าจอ:

ค่าการค้นหา doc ในหลายแผ่น 4

5 คลิก OK ไปยัง ปิดการขาย และเซลล์ที่พบทั้งหมดจะแสดงรายการในแผ่นงานปัจจุบันพร้อมข้อมูลที่เกี่ยวข้อง

ค่าการค้นหา doc ในหลายแผ่น 5

เคล็ดลับ: ใน VBA ด้านบนคุณค้นหาค่า “ KTE”และคุณสามารถเปลี่ยนแปลงได้ “ KTE” จากนี้ xStrSearch = "KTE" เป็นค่าอื่นตามที่คุณต้องการ


หากคุณต้องการค้นหาค่าในสมุดงานที่เปิดไว้หลายเล่มคุณสามารถใช้ Kutools สำหรับ Excel 'ขั้นสูง ค้นหาและแทนที่ ประโยชน์

Kutools สำหรับ Excel, ที่มีมากกว่า 300 ฟังก์ชั่นที่มีประโยชน์ทำให้งานของคุณง่ายขึ้น 

หลังจาก ติดตั้งฟรี Kutools สำหรับ Excel โปรดทำดังนี้:

1. ในสมุดงานที่เปิดอยู่ให้คลิก Kutools > การเดินเรือแลวคลิกปุ the ม ค้นหาและแทนที่ ปุ่ม ปุ่มค้นหาเอกสาร เพื่อไปที่ ค้นหาและแทนที่ บานหน้าต่าง ดูภาพหน้าจอ:

ค่าการค้นหา doc ในหลายแผ่น 6

2 จากนั้นคลิก หา แล้วพิมพ์ค่าที่คุณต้องการค้นหาในไฟล์ สิ่งที่ค้นหา กล่องข้อความแล้วเลือก สมุดงานทั้งหมด จาก ภายใน รายการแบบเลื่อนลงและไปที่คลิก ค้นหาทั้งหมด เพื่อแสดงรายการเซลล์ที่พบทั้งหมด ดูภาพหน้าจอ:
doc kutools ค้นหาการแทนที่ 2

เคล็ดลับ:

กับ Kutools สำหรับ Excelขั้นสูง ค้นหาและแทนที่ ยูทิลิตี้คุณสามารถค้นหาและแทนที่ค่าในแผ่นงานที่เลือกในสมุดงานหลายเล่มสมุดงานทั้งหมดสมุดงานที่ใช้งานแผ่นงานหรือส่วนที่เลือก
doc kutools ค้นหาการแทนที่ 3


บทความญาติ:

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, 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