Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Search cell value in more than one workbook

Is there anyway I can serch for a cell value in more than one workbook?
I have workbooks that are saved in one folder nad I need to be able to find
cell value and determin in which file (or workbook) it appears. Using the
find and replace would look only in one workbook.
Thank you
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Search cell value in more than one workbook

Hi,

I think you need code for this. The code below opens every workbook in a
directory and call a sub where you can look for your value

Sub LoopThroughDirectory()
Application.DisplayAlerts = False
'Change this to your directory
MyPath = "C:\"
ActiveFile = Dir(MyPath & "*.xls")
Do While ActiveFile < ""
Workbooks.Open Filename:=MyPath & ActiveFile
'Here is the line that calls the macro below, passing the workbook to it
DoSomething ActiveWorkbook
ActiveWorkbook.Close
ActiveFile = Dir()
Loop
Application.DisplayAlerts = True
End Sub

Sub DoSomething(Book As Workbook)
'test cell value
MsgBox ActiveWorkbook.Name

End Sub

Mike

"DreamKid" wrote:

Is there anyway I can serch for a cell value in more than one workbook?
I have workbooks that are saved in one folder nad I need to be able to find
cell value and determin in which file (or workbook) it appears. Using the
find and replace would look only in one workbook.
Thank you

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Search cell value in more than one workbook

Thank Mike for the information.
I ran the code and it opens he file display a message and then closes the
file then to the next. It does not allow me to run the find box or to enter
what to find. Any idea?
Thank you

"Mike H" wrote:

Hi,

I think you need code for this. The code below opens every workbook in a
directory and call a sub where you can look for your value

Sub LoopThroughDirectory()
Application.DisplayAlerts = False
'Change this to your directory
MyPath = "C:\"
ActiveFile = Dir(MyPath & "*.xls")
Do While ActiveFile < ""
Workbooks.Open Filename:=MyPath & ActiveFile
'Here is the line that calls the macro below, passing the workbook to it
DoSomething ActiveWorkbook
ActiveWorkbook.Close
ActiveFile = Dir()
Loop
Application.DisplayAlerts = True
End Sub

Sub DoSomething(Book As Workbook)
'test cell value
MsgBox ActiveWorkbook.Name

End Sub

Mike

"DreamKid" wrote:

Is there anyway I can serch for a cell value in more than one workbook?
I have workbooks that are saved in one folder nad I need to be able to find
cell value and determin in which file (or workbook) it appears. Using the
find and replace would look only in one workbook.
Thank you

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
I need an Equation in a cell to search a workbook not worksheet MWhaley Excel Worksheet Functions 5 November 2nd 08 12:27 AM
Search Workbook aftamath77 Excel Discussion (Misc queries) 1 May 19th 08 05:28 PM
Search Data from one Workbook and copy it into another Workbook Matz Excel Discussion (Misc queries) 0 August 4th 06 10:45 AM
Search within workbook Mare New Users to Excel 3 October 10th 05 07:17 PM
Search workbook fda secretary Excel Discussion (Misc queries) 2 August 24th 05 07:48 PM


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