Article ID: 282151 - Last Review: January 29, 2007 - Revision: 3.2 Macro that uses FindNext to search for specific format finds wrong cell in ExcelThis article was previously published under Q282151 SYMPTOMS
When you use a Microsoft Visual Basic for Applications macro to search for cells with specific formatting, the macro may incorrectly find cells that do not match the formatting that you specified.
CAUSE
This behavior can occur because the macro uses the FindNext or FindPrevious method, each of which ignores format settings used in the preceding Find method. NOTE: If you click Find Next while recording a macro, the FindNext method is used. WORKAROUND
To work around this behavior, replace all instances of FindNext and FindPrevious with Find. The second and subsequent Find commands need to have the optional After and SearchFormat parameters. For example, if the recorded code appears as follows STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. | Article Translations
|
Back to the top
