I am trying to get a code that will search for a term, highlight the row that term appears in, then select the range between that term and the next time data shows up in that column.
Below is what I came up with so far. I know through recent research that activate and select aren't the best to use so if there is a better way I am open to it. Everything works up until the last row and then it gives me a run time 1004 error.
Below is what I came up with so far. I know through recent research that activate and select aren't the best to use so if there is a better way I am open to it. Everything works up until the last row and then it gives me a run time 1004 error.
VBA Code:
Sheets("Labor Report").Activate
Sheets("Labor Report").Range("A1").EntireColumn.Select
Selection.Find(What:="US Last code", After:=ActiveCell, LookIn:= _
xlFormulas2, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Select
Selection.EntireRow.Select
Range(Selection, Selection.End(xlDown)).Select
Last edited by a moderator: