Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 354
Default Search/Find in any worksheet

Hello,

Is it possible to search for a string in all the worksheets of a workbook and not just the active worksheet? If not, is it possible to make a macro to do so (could someone give me a hand)?

Thank you

Daniel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Search/Find in any worksheet

Daniel,

The sub bleow will find all complete matches of the entered string in the
active workbook.

HTH,
Bernie
MS Excel MVP

Sub FindAllValuesInWorkbook()
Dim c As Range ' The cell found with what you want
Dim d As Range ' All the cells found with what you want
Dim myFindString As String
Dim firstAddress As String
Dim mySht As Worksheet

myFindString = InputBox("Enter the key word for finding", _
, "What to find")
For Each mySht In ActiveWorkbook.Worksheets
With mySht.Cells

Set c = .Find(myFindString, LookIn:=xlValues, lookAt:=xlWhole)

If Not c Is Nothing Then
Set d = c
firstAddress = c.Address
Else:
MsgBox "Not Found"
GoTo NotFound:
End If

Set c = .FindNext(c)
If Not c Is Nothing And c.Address < firstAddress Then
Do
Set d = Union(d, c)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
'Then do what you want with all
'the cells that have been found, like
MsgBox "On sheet " & mySht.Name & ", found in " & d.Address
NotFound:
Next mySht

End Sub


"Daniel" wrote in message
...
Hello,

Is it possible to search for a string in all the worksheets of a workbook

and not just the active worksheet? If not, is it possible to make a macro
to do so (could someone give me a hand)?

Thank you

Daniel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Search/Find in any worksheet

Hi
try Jan Karel Pieterse's FLEXFIND.XLA from

http://www.bmsltd.ie/mvp/

--
Regards
Frank Kabel
Frankfurt, Germany


Daniel wrote:
Hello,

Is it possible to search for a string in all the worksheets of a
workbook and not just the active worksheet? If not, is it possible
to make a macro to do so (could someone give me a hand)?

Thank you

Daniel

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
Search / Find Function Harry C. Excel Worksheet Functions 6 June 16th 09 05:40 PM
Search one worksheet to pull data into another worksheet HyperMite Excel Worksheet Functions 6 March 4th 09 01:53 PM
IF with Search/Find??? TotallyConfused Excel Worksheet Functions 5 August 1st 08 10:05 AM
Can Search find 2 or more "/"? Wind54Surfer Excel Discussion (Misc queries) 2 February 22nd 05 04:31 PM
Search and find Rick K Excel Programming 1 August 21st 03 04:15 AM


All times are GMT +1. The time now is 03:20 AM.

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

About Us

"It's about Microsoft Excel"