Find in column and copy
Give this a wirl...
Sub FindAndMove()
Dim wksToSearch As Worksheet
Dim rngToSearch As Range
Dim rngFound As Range
Dim strFirst As String
Dim strSearchText As String
strSearchText = "this" 'Change This
Set wksToSearch = Sheets("Sheet1") 'Change This
Set rngToSearch = wksToSearch.Columns("A")
Set rngFound = rngToSearch.Find(What:=strSearchText, _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Sorry. Nothing was found"
Else
strFirst = rngFound.Address
Do
rngFound.Offset(-1, 2) = rngFound.Offset(0, 1)
rngFound.Offset(0, 1).ClearContents
Set rngFound = rngToSearch.FindNext(rngFound)
Loop Until rngFound.Address = strFirst
End If
End Sub
--
HTH...
Jim Thomlinson
"Syscon" wrote:
I am new to macros. I have managed to do most in the project but this one has
stumped me.
I want to search Col. "A" for a text string. When found, cut the cell
contents to the right of the text from Col. "B" and paste it up one line and
into Col. "C". Then continue searching Col. "A" for more instances of the
text string.
Richard
|