sneakymist
New Member
- Joined
- Jan 16, 2018
- Messages
- 3
I am trying to create a code that does two things:
- First, the code will search for a column that contains a given text within the worksheet.
- Afterwards, the code will search for the row with the last non-blank cell in the worksheet, while remaining on the same column as 1.
As shown in the example above, the code would first search for the text "FIRST" in A1. Afterwards, it will search for the last non-blank cell in the worksheet, which is C11. However, it should remain in the column that contains "FIRST", so that only the row changes. The final result would be A11.
So far, I found the code that lets me do 1.
Code:[CODE]Cells.Find(what:="FIRST", after:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
and another code that lets me do 2.,
Cells.Find(what:="*",
after:=Range("A1"),
LookAt:=xlPart,
LookIn:=xlFormulas,
SearchOrder:=xlByRows,
SearchDirection:=xlPrevious,
MatchCase:=False).Activate
[/CODE]
However, I am unable to use them together to achieve my intended goal.
Any suggestions to answer this would be appreciated. Thank you!