O365 Excel (where have they hidden version numbers! Gosh!?)
I have a sheet with 2000+ rows and a column that contains...
2 pcs: ... 3 pcs: ... 10 pcs: ... ... <cursor-position>
I wish to FIND the PREVIOUS cell that has "pcs" in it,
so the search should go "backward" (up, toward lesser row number)
ignoring the current cell...
My code has FIND used like this:
ActiveCell.Columns("A:A").EntireColumn.Select ' stay in current column
Selection.Find(What:="Pcs", LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _ ' go backwards
MatchCase:=False, SearchFormat:=False).Activate
Currently this seems to impossible get going BACKWARDS.
(The idea here is to achieve a one time only re-work of the data,
duplicating the lines, to make there be 10 copies of lines with "10 pcs" stated)
Google searches turns up all but xlPrevious thingies.
An additional After:=ActiveCell, _
doesn't help...
still looking for an answer to this as I'd like to have MY code actually work; and secondarily to get to understand where the problem is.
NOTED: CTRL-F Dialog has no "Search backwards" option.
The answers below has shown that there are other (and better) ways to do this, what still remains is to UNDERSTAND why the behavior is as is.
My code is a slightly modified version of a macro recorded with "Use Relative references" set.