Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search orkbook

Greetings,

I use the following code to find MyNumber within the current worksheet:

Cells.Find(What:=MyNumber, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False, _
SearchFormat:=False).Activate

Would appreciate someone advising what changes are required to the above to
search
the entire workbook instead of just the current worksheet.

Thanks.

Regards, Bob Mignault




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Search orkbook

How about something like this UNTESTED code:

Dim w as worksheet

For each w in worksheets
w.cells.find(What:=MyNumber).Activate
msgbox "Click OK to find next hit"
Next

The key is to just do the same thing on each worksheet; you can loop through
them with the "For...Each" construct.
--
HTH -

-Frank
Microsoft Excel MVP
Dolphin Technology Corp.
http://vbapro.com



"Bob Mignault" wrote in message
...
Greetings,

I use the following code to find MyNumber within the current worksheet:

Cells.Find(What:=MyNumber, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False, _
SearchFormat:=False).Activate

Would appreciate someone advising what changes are required to the above

to
search
the entire workbook instead of just the current worksheet.

Thanks.

Regards, Bob Mignault






  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Search orkbook

You need to watch for linewrap. This will get you started. It cycles
through all sheets, and changes all instances of
MyNumber to a gray interior color.

Sub FindMe()
' Highlights cells that contain MyNumber

Dim rngC As Range
Dim FirstAddress As String
Dim wSht as Worksheet
Dim MyNumber

MyNumber = 37358

For Each wSht in WorkSheets

wSht.Activate

With wSht.UsedRange
Set rngC = .Find(what:=MyNumber, LookAt:=xlWhole)
If Not rngC Is Nothing Then
FirstAddress = rngC.Address
Do
rngC.Interior.Pattern = xlPatternGray50
Set rngC = .FindNext(rngC)
Loop While Not rngC Is Nothing And rngC.Address <
FirstAddress
End If
End With

Next wSht

End Sub

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
On Mon, 15 Sep 2003 15:13:16 -0400, "Bob Mignault"
wrote:

Greetings,

I use the following code to find MyNumber within the current worksheet:

Cells.Find(What:=MyNumber, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False, _
SearchFormat:=False).Activate

Would appreciate someone advising what changes are required to the above to
search
the entire workbook instead of just the current worksheet.

Thanks.

Regards, Bob Mignault




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
Two search category & two search terms avk Excel Discussion (Misc queries) 1 June 2nd 10 01:25 PM
file search or search files Richad Excel Discussion (Misc queries) 0 October 22nd 09 07:56 PM
Functions (search within search result) reply to this please Nick Excel Worksheet Functions 1 February 17th 09 03:57 AM
Functions (search within search result) Nick Excel Worksheet Functions 1 February 17th 09 03:51 AM
How do I search excel spreadsheets using multiple search criteria. Kasper Excel Worksheet Functions 4 December 15th 05 12:26 AM


All times are GMT +1. The time now is 07:56 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"