I have used this code to find certain "text markers" which identify, for example, column headers.
Cells.Find(What:="ST:", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines
Record entries are in rows. A row may have one or more comments, each in separate columns. A comment may include a Status
flag, which includes the prefix of "ST:". I only want to find the last comment that includes a status string, since that
should be the most recent status for that record (in rows). Some records may not include any comments that contain status
So, the desired variation on the above cells.find search is this:
What: Identify a "marker" string to find. In this case, it is "ST:", case sensitive.Where: Search only in the active row,
where I have already identified the last filled column in that row, which is the most recent entry.Direction: Search from
right (last column) to left (column A) and stop on the first match. The marker, "ST:" will not be the only text in the
cell.While I would prefer to use an efficient command like cells.find, I know that I can also move across the row right to
left and check each cell. I have seen at least one other forum entry taht Where elegance falls short, brute force will get
the work done.
If a target string is found in a cell, I can do the rest to extract the status text (8 characters)
that come after the "ST:" marker.
Many thanks for suggestions if there is a single command solution. I am
programming the brute force - cell-by-cell - method in the interim.