這是一個開始。你的筆記表明這些詞只會在每張紙上出現一次,並且會有一排72行的單元格。我已經包含了關於檢查這兩個項目的說明,但只是粗略的。
Dim c As Range
Dim s As Worksheet
Dim sr As Worksheet ''For results
Dim r1 As Long ''Row counter
Dim i As Long ''Incidence counter
Dim firstAddress As Variant
''New worksheet for results
Set sr = ActiveWorkbook.Worksheets.Add
r1 = 1
''It might be better to use a named workbook
For Each s In ActiveWorkbook.Worksheets
''Don't check results sheet
If s.Name <> sr.Name Then
''From: http://msdn.microsoft.com/en-us/library/aa195730(v=office.11).aspx
With s.UsedRange
Set c = .Find("THIS IS A TEST", LookIn:=xlValues, LookAt:=xlWhole)
i = 0
If Not c Is Nothing Then
firstAddress = c.Address
sr.Cells(r1, 1) = c.Value
If c.Row - 72 > 0 Then
sr.Cells(r1, 2) = s.Cells(c.Row - 72, c.Column)
Else
sr.Cells(r1, 2) = "Error"
End If
i = 1
r1 = r1 + 1
Do
i = i + 1
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End If
Debug.Print s.Name & " found: " & i
Next