Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Needle in a haystack...searching for VBA code in all Excel sheets orfinding xls users of xla sheets....

I can't think of a way but I hope there is one where I can search a
directory of Excel sheets for a function call. Or ones that use
certain xla files.

Otherwise, I have to pull out my hair.

THANKS

John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Needle in a haystack...searching for VBA code in all Excel sheets

Let's say we have a group of workbooks in a folder and we suspect that on
some sheet of some workbook the function =SUM() is being used. We want to
find the workbook, the sheet, and the cell holding the function:

1. open the workbooks in the folder
2. run the following:

Sub findit()
For Each wb In Workbooks
wb.Activate
For Each sh In wb.Sheets
sh.Activate
For Each r In sh.UsedRange
v = r.Formula
If InStr(v, "SUM(") 0 Then
r.Select
Exit Sub
End If
Next
Next
Next
End Sub

Clearly this code can be modified to open each workbook in series.
--
Gary''s Student - gsnu2007i


"CodeMonkey" wrote:

I can't think of a way but I hope there is one where I can search a
directory of Excel sheets for a function call. Or ones that use
certain xla files.

Otherwise, I have to pull out my hair.

THANKS

John

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
Searching Multiple sheets in excel BIG FRED Excel Worksheet Functions 3 July 9th 08 12:37 AM
Searching across all sheets JoeSpareBedroom Excel Discussion (Misc queries) 9 May 8th 08 04:26 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Programming 6 March 29th 06 12:43 PM
How to find a needle in a haystack? ScottJSP Excel Discussion (Misc queries) 1 February 4th 05 04:12 AM


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

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"