Find text string and move contents to another cell
Give this macro a try...
Sub MovePRPs()
Dim R As Range
On Error GoTo NextSearch
Do
Set R = Columns("N").Find("PRP", LookAt:=xlPart, MatchCase:=False)
R.Offset(, 3).Value = R.Value
R.Clear
Loop
PRODs:
On Error GoTo Done
Do
Set R = Columns("N").Find("PROD", LookAt:=xlPart, MatchCase:=False)
R.Offset(, 4).Value = R.Value
R.Clear
Loop
NextSearch:
Resume PRODs
Done:
End Sub
--
Rick (MVP - Excel)
"Philusofical" wrote in message
...
How can I find a specific string in a worksheet and move it to another
column?
In Excel 2003, Sheet Range A1:N250
Column "N" of a worksheet "spares" contains text "PRP Pxxxxx" or "Prod
xxxxx" where x is a number. I want to cut and paste anything containing
"PRP" to column Q, and "Prod" to column R, leaving the cell in column N
blank.
Thanks in advance for any advice
|