Forum Discussion
hrh_dash
Oct 14, 2022Iron Contributor
Find all specific text and copy into another sheet using a do until loop
How can amend the code below to copy text at specific cells if there are more than one find. For example, if there are 3 Finds of "OWNER" and therefore i would want all the data pertaining to "OW...
- Oct 14, 2022
By the way, I'd do the loop like this, it's slightly more efficient.
Do lastRow = lastRow + 1 ws_N.Range("B" & lastRow).Value = rng.Offset(0, -1).Value ws_N.Range("A" & lastRow).Value = rng.Offset(0, -2).Value Set rng = ws.UsedRange.FindNext(rng) If rng Is Nothing Then Exit Sub Loop Until rng.Address = adr
HansVogelaar
Oct 14, 2022MVP
By the way, I'd do the loop like this, it's slightly more efficient.
Do
lastRow = lastRow + 1
ws_N.Range("B" & lastRow).Value = rng.Offset(0, -1).Value
ws_N.Range("A" & lastRow).Value = rng.Offset(0, -2).Value
Set rng = ws.UsedRange.FindNext(rng)
If rng Is Nothing Then Exit Sub
Loop Until rng.Address = adr
hrh_dash
Oct 14, 2022Iron Contributor
, thanks for the help!