Forum Discussion
renee_crozier
Apr 17, 2024Brass Contributor
Find, Select Row, and Select up to Row 1 Using VBA Code
 Using VBA code, I'm looking to use the Find and Replace dialogue box, find a certain item, select the entire row of data, and then select all the way up to row 1 and then copy it.     For this, I am ...
- Apr 17, 2024The following does not select the range, but it does copy it, ready to be pasted elsewhere: Dim rng As Range Set rng = Cells.Find(What:=":", After:=ActiveCell, LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False) Range(Range("A1"), rng).EntireRow.Copy
HansVogelaar
Apr 17, 2024MVP
The following does not select the range, but it does copy it, ready to be pasted elsewhere:
    Dim rng As Range
    Set rng = Cells.Find(What:=":", After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False)
    Range(Range("A1"), rng).EntireRow.Copy