LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Find text string and move contents to another cell

Many thanks for the code. Much appreciated

"Rick Rothstein" wrote:

This is a little bit less efficient, but more readable, than the other code
I posted... but as Steven pointed out, we are not talking about a lot of
cells here, so the inefficiencies in this code should be well masked...

Sub MovePRPs()
Dim C As Range
Dim X As Long
For X = 1 To 250
Set C = Cells(X, "N")
If C.Value Like "PRP*" Then
C.Offset(, 3).Value = C.Value
C.Clear
ElseIf C.Value Like "PROD*" Then
C.Offset(, 4).Value = C.Value
C.Clear
End If
Next
End Sub

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
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






 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
FIND / SEARCH text compare cell to string in 3rd cell nastech Excel Discussion (Misc queries) 0 October 29th 07 02:51 AM
Need to find particular string within cell text, if found a value is copied [email protected] Excel Programming 4 November 15th 06 09:14 PM
Display contents of cell in another cell as part of text string? [email protected] New Users to Excel 3 July 8th 06 07:44 PM
VBA - Move cell contents if bold text Scott Wagner Excel Programming 2 March 14th 06 04:10 PM
Find text and move it to other cell broogle Excel Programming 7 September 20th 05 08:19 AM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"