
Tips.Net > ExcelTips Home > Tools > Searching a Workbook by Default
Summary: When you display the Find tab of the Find and Replace dialog box, you’ll notice that any search, by default, will be on the current worksheet. If you want Excel to default to searching the entire workbook, you may be out of luck. (This tip works with Microsoft Excel 97, Excel 2000, Excel 2002, Excel 2003, and Excel 2007.)
When you display the Find tab of the Find and Replace dialog box (pressing Ctrl+F is the easiest way), Excel makes certain assumptions about what exactly you want to search. What you want to search is dictated by the setting of the Within drop-down list. When you first display the Find and Replace dialog, Within is set to Sheet, by default. (Click here to see a related figure.) This setting is true regardless of whether you select one worksheet or multiple worksheets prior to displaying the dialog box.
If you want the Within drop-down list to default to Workbook (instead of Sheet), there is no way to specify this in Excel. You can take some solace in the fact that the setting of the Within drop-down list is persistent for the current session with Excel. In other words, if you set it to Workbook, complete your search, and later display the Find tab of the Find and Replace dialog, box then Within is still set to Workbook.
It is interesting that there appears to be no way tackle this issue using a macro, either. This is because Excel doesn't provide a way for a macro to display and modify the settings in the Find and Replace dialog box. Many dialog boxes can be displayed, but not the Find and Replace. Instead, VBA allows you to display an older version of the Find dialog box (Click here to see a related figure.) , using this code:
Sub ShowFind()
Application.Dialogs(xlDialogFormulaFind).Show
End Sub
Unfortunately, this version of the Find dialog box does not have a control that allows you to specify the scope of the search, as can be done with the Within drop-down list in the Find tab of the Find and Replace dialog box.
Tip #3170 applies to Microsoft Excel versions: 97 2000 2002 2003 2007
More Power! For some people, the prospect of creating macros can be scary. Those who conquer their fears, however, find they become much more confident and productive once they learn how to make Excel do exactly what they want. ExcelTips: The Macros is an invaluable source for learning Excel macros. You are introduced to the topic in bite-sized chunks, pulled from past issues of ExcelTips. Learn at your own pace, exactly the way you want.
Check out ExcelTips: The Macros today!
Add power to your purpose with Excel. A comprehensive 500+ page e-book explains everything you need to know about macros. (more information...)
Ask an Excel Question
Make a Comment
ExcelTips FAQ
ExcelTips Premium
Beauty Tips
Bugs and Pests Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pet Tips
Word2007 Tips
WordTips
Advertise on the
ExcelTips Site