#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Finding Buried Text

Anybody know of a search engine that will find a word or phrase in a file,
such as Excel, which has several 'sub' documents/worksheets, and
identify not only the file but the worksheet it is on? I have Agent
Ransack, which is good but doesn't seem to do that.

Thx
Dave


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Finding Buried Text

This small macro will search all the sheets of a workbook for some text and
reports both the sheet name and cell address where the text can be found:


Sub gsnu()
Dim r As Range
Dim text As String
Dim ws As Worksheet

text = "happy"

For Each ws In Worksheets
ws.Activate
For Each r In ActiveSheet.UsedRange
If InStr(1, r.Value, text) 0 Then
MsgBox (ws.Name & " " & r.Address)
End If
Next
Next

End Sub

The macro can easily be modified to loop over all open workbooks.
--
Gary's Student


"Dave" wrote:

Anybody know of a search engine that will find a word or phrase in a file,
such as Excel, which has several 'sub' documents/worksheets, and
identify not only the file but the worksheet it is on? I have Agent
Ransack, which is good but doesn't seem to do that.

Thx
Dave



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 55
Default Finding Buried Text

Worked great - thank you

Now - since my macro skills are weak, how would I expand this to the other
workbooks, open or (what I'd really like) closed???

Dave



"Gary''s Student" wrote in message
...
This small macro will search all the sheets of a workbook for some text
and
reports both the sheet name and cell address where the text can be found:


Sub gsnu()
Dim r As Range
Dim text As String
Dim ws As Worksheet

text = "happy"

For Each ws In Worksheets
ws.Activate
For Each r In ActiveSheet.UsedRange
If InStr(1, r.Value, text) 0 Then
MsgBox (ws.Name & " " & r.Address)
End If
Next
Next

End Sub

The macro can easily be modified to loop over all open workbooks.
--
Gary's Student


"Dave" wrote:

Anybody know of a search engine that will find a word or phrase in a
file,
such as Excel, which has several 'sub' documents/worksheets, and
identify not only the file but the worksheet it is on? I have Agent
Ransack, which is good but doesn't seem to do that.

Thx
Dave





  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Finding Buried Text

Hi Dave:

Search un-openned workbooks is possible, but difficult. This routine is
similar to the first, but will search all open workbooks and worksheets for
the text:


Sub gsnu2()
Dim r As Range
Dim text As String
Dim ws As Worksheet
Dim wb As Workbook

text = "happy"
For Each wb In Workbooks
For Each ws In Worksheets
ws.Activate
For Each r In ActiveSheet.UsedRange
If InStr(1, r.Value, text) 0 Then
MsgBox (ws.Name & " " & r.Address)
MsgBox (wb.Name)
End If
Next
Next
Next
End Sub

The mesages give you the workbook, the worksheet and the cell address.
--
Gary''s Student


"Dave" wrote:

Worked great - thank you

Now - since my macro skills are weak, how would I expand this to the other
workbooks, open or (what I'd really like) closed???

Dave



"Gary''s Student" wrote in message
...
This small macro will search all the sheets of a workbook for some text
and
reports both the sheet name and cell address where the text can be found:


Sub gsnu()
Dim r As Range
Dim text As String
Dim ws As Worksheet

text = "happy"

For Each ws In Worksheets
ws.Activate
For Each r In ActiveSheet.UsedRange
If InStr(1, r.Value, text) 0 Then
MsgBox (ws.Name & " " & r.Address)
End If
Next
Next

End Sub

The macro can easily be modified to loop over all open workbooks.
--
Gary's Student


"Dave" wrote:

Anybody know of a search engine that will find a word or phrase in a
file,
such as Excel, which has several 'sub' documents/worksheets, and
identify not only the file but the worksheet it is on? I have Agent
Ransack, which is good but doesn't seem to do that.

Thx
Dave






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding a Text match Richard Excel Discussion (Misc queries) 0 August 22nd 06 05:41 PM
Finding text within text Jambruins Excel Discussion (Misc queries) 0 March 20th 06 05:04 PM
Text Wrapping JMB Excel Discussion (Misc queries) 0 July 29th 05 02:41 AM
Finding Duplicate text strings with a single column Ed P Excel Worksheet Functions 2 March 17th 05 03:56 AM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 06:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"