0
votes

I've been using Range.Find and Range.Replace and haven't figured out under what circumstances they only search visible cells and under what circumstances they search both visible and hidden cells.

The following is an example that searches visible and hidden cells:

r.Replace what:=fw, replacement:=rw, lookat:=xlPart, matchcase:=False

The following is an example that searches only visible cells:

lastRowOutput = Sheets("Output").Cells.Find("*", [A1], , , xlByRows, xlPrevious).row

Is there any predictable pattern to when the methods above search only visible cells or both visible and hidden cells?

EDIT: Or rather, it seems like both methods above search both visible and hidden cells, but neither searches for cells that have been hidden by a filter. This confuses me very much. Why do they search ordinary hidden cells but not cells that have been hidden by a filter?

1

1 Answers

1
votes

If you hide a row with AutoFilter, it will be hidden from FIND()
If you hide a row manually, it will be hidden from FIND()
If you hide a row by setting its height to zero, it will be visible to FIND()