ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HELP WITH AN EXCEL PROBLEM (https://www.excelbanter.com/excel-programming/371521-help-excel-problem.html)

[email protected]

HELP WITH AN EXCEL PROBLEM
 
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


Tom Ogilvy

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





All times are GMT +1. The time now is 06:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com