Computer geek, and self-appointed know-it-all, Westley Annis answers all those hard 

questions about anything related to computers and technology, as well as business and 

political questions.

Change Excel Find Formula Defaults

Dear Westley, In an xcell worksheet, using the "find" icon initially, the settings are for "rows" and "formulas". I rarely search by rows and almost never by formulas. It would be far handier if the "initial" choices were already set to "columns" and "values" -- which is how I search 98% of the time. Q -- Is there a way to change the script so that the initial choices would be set to the way I most often search?

Many people may complain that Excel is a complicated application, but once you learn how to turn all that extra complication in your favor, things suddenly look rosey.

Using Visual Basic for Applications (VBA), the programming language of all Microsoft Office applications, you can change the defaults for any command available on Excel's many menus. In this case, you want to change the default for the Edit->Find command.

The first step is using code to display the same dialog box that Excel displays. There is good news and bad news about this step. The good news is that displaying the dialog box is simple as can be. The bad news, the many options available to change the dialog box are not defined any place that I could find, so it takes a bit of experimenting to get just the options you want.

For this example, we only needed one line of code, so I'm going to show the entire macro, complete with the Sub and End Sub container markers.

Sub EditFind()
    Application.Dialogs(xlDialogFormulaFind).Show , 2, , 2
End Sub

Looking at the code, you can see it just makes a reference to the Dialogs collection inside the Excel Application, specifies the FormulaFind dialog box, and tells it to Show itself. The arguments (which are seperated by commas) to customize the appearance are passed at the end of the line.

The first argument (Find what:), which is blank, is the value to be searched for. The second argument (Search in:)listed specifies whether to search by Formulas (1), Values (2), or Comments(3). The third argument (Match entire cell contents:), again left blank for our purposes, specifies whether to search the entire cell or not (True or False). The fourth argument (Search:) specifies whether to search by Rows (1) or Columns (2). I'll live it to others to determine the other arguments available for now.

Now, you have the code, how do you use it?

Visit this page to learn how to install the code into your spreadsheet. After you've installed the code, visit this page to add a button to one of your toolbars to point to the macro.

Category is Microsoft Office   (Article #13)
Comments
This site is incredible!
This site is incredible! It's amazing the questions you get asked and you always come up with the answer. I've just got to help you stay cool by buying you a Snoball!
I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited
email, period. I hate it just as much as you do.

Also note that by submitting a question or comment
you're agreeing to relinquish any subsequent rights of
ownership to your material by submitting it on this site.









Ask Westley your question on technology, business, or politics!
RDF XML
Add to My Yahoo!
Subscribe in 
NewsGator Online
Feedburner
Search



All Categories
Archives by Category
Book Links
Powered by
Movable Type 3.34
© 2005 by Westley Annis. All Rights Reserved.

Valid XHTML 1.0!