I use Ctrl-F frequently in Excel to find things in workbooks across multiple sheets so the "Within" field is usually set to "Workbook". I also run macros and find that a side effect of running them is that when doing Ctrl-F from within Excel that the "Within" field is reset back to "Sheet" when it was "Workbook" prior to that. I tracked down that the find method is where this reset happens and was wondering how I can make sure the "Within" setting is back to whatever it was before the macro was run. My macro has the following:
lastCol = Sheets(sheetFocus).Cells.Find("*", [a1], , , xlByColumns, xlPrevious).Column
lastRow = Sheets(sheetFocus).Cells.Find("*", [a1], , , xlByRows, xlPrevious).row
I don't see which parameter is resetting things in Excel for Ctrl-F. Is there a way to either stop the side effect or test what the "Within" setting was before doing the find method so that I can set it back afterwards?