View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default HELP WITH AN EXCEL PROBLEM

Sub CopyData()
Dim ans As String, rng1 As Range, rng As Range
Dim sAddr As String
ans = InputBox("Enter Search Term:")
If ans = "" Then Exit Sub
With ActiveSheet
Set rng = .Range(.Range("C2"), .Cells(Rows.Count, "C").End(xlUp))
Set rng1 = rng.Find(What:=ans, _
After:=rng(rng.Count), _
LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng1 Is Nothing Then
sAddr = rng1.Address
Do
.Cells(rng1.Row, "E").Value = .Cells(rng1.Row, "C").Value
Set rng1 = rng.FindNext(rng1)
Loop While rng1.Address < sAddr
Else
MsgBox ans & " was not found"
End If
End With
End Sub

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
I have a data sheet containing 10k rows of survey data. I would like to
know if anyone could help me with a macro that would
1.prompt me for a search term ie. "earthlink"
2.go through all 10000 rows of data in column C and copy the cells that
contain the search term
3.paste the cells in the same row # only in column E.

Is this possible to do? It would save me sooooo much time. I would be
very grateful if anyone would help me with this.
Thanks in advance
Joe