Chaz,
I think that the macro code below will do the trick for you, and I believe
it will run on '97.
To put this code into your workbook:
Choose Tools | Macro and select the Visual Basic Editor from the list.
From the VB Editor's menu choose Insert | Module
Copy the code below and paste it into the module that opens. Change the
name of the worksheet and first list cell address in the code if you need to.
Close the VB Editor. Then back in the workbook, choose Tools | Macro |
Macros and choose the [ReportTextFound] macro and click the [Run] button. If
it fails, hit the [Debug] button and let me know what line is highlighted -
that will be the line that created the error. I don't think it'll error out
on you, but i could be wrong - there may be something in my Selection.Find
statement that Excel 97 doesn't like.
Sub ReportTextFound()
'change this sheet name definition to
'the name of the sheet with your list
'of text to find
Const myListSheet = "Sheet1"
'change this to the address of the
'first cell on the list sheet with
'text to be found
Const listStart = "A1"
Dim anySheet As Worksheet
Dim searchFor As String
Dim baseCell As Range
Dim rOffset As Integer
Dim cOffset As Integer
Worksheets(myListSheet).Select
Range(listStart).Select
Set baseCell = Worksheets(myListSheet).Range(listStart)
Application.ScreenUpdating = False ' faster
For Each anySheet In Worksheets
If anySheet.Name <> myListSheet Then
cOffset = cOffset + 1
rOffset = 0
anySheet.Activate
'list must not have gaps in it, it will
'stop on an empty cell
Do Until IsEmpty(baseCell.Offset(rOffset, 0))
searchFor = baseCell.Offset(rOffset, 0)
anySheet.Cells.Select
On Error Resume Next
Selection.Find(What:=searchFor, After:=ActiveCell, _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False, _
SearchFormat:=False).Activate
If Err = 0 Then
'found match
baseCell.Offset(rOffset, cOffset) = anySheet.Name
Else
Err.Clear
End If
On Error GoTo 0
rOffset = rOffset + 1
Loop ' list loop
Range("A1").Select ' just for neatness
End If
Next ' look at another sheet
Worksheets(myListSheet).Select
Application.ScreenUpdating = True
End Sub