XL: VB Procedure to Emulate Find Command (124924)
The information in this article applies to:
- Microsoft Excel 97 for Windows
- Microsoft Excel for Windows 95
- Microsoft Excel for Windows 5.0
- Microsoft Excel 98 Macintosh Edition
This article was previously published under Q124924 SUMMARY
You can create a Microsoft Visual Basic for Applications procedure that
emulates the behavior of the Microsoft Excel Find command. To do this, use
the Find and FindNext methods in a Visual Basic module.
The code in the "More Information" section of this article allows you to
find all occurrences of a search string in the active worksheet without
changing the selection or the active cell. When the search text is
located, the code displays a message box with the address of the cell
that contains the search string. If the search text is not found, a
"Search Value Not Found" message box is displayed.
NOTE: You can easily modify this code by replacing the MsgBox statements
with the code that you want to run whenever the search text is or is not
found.
REFERENCES
"Visual Basic User's Guide," pages 148-149
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbdtacode kbhowto kbProgramming KB124924 |
---|
|