Multiple search and copy
Joel
The only thing I have changed in your code was the column and the words
which did not work.
The columns I have are
WKS ID Date Time Proxy Site
The code below I was using works to an extent but only on single words and
it ends with an error but it does copy selected rows to Sheet2.
Sub test()
Dim FilterValue As String
Dim rng As Range
Dim rng2 As Range
Set rng = Range("F:F")
FilterValue = "*sports*"
rng.AutoFilter Field:=1, Criteria1:=FilterValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then
rng2.EntireRow.Copy Sheets("Sheet2").Range("A1")
End If
End With
ActiveSheet.AutoFilterMode = False
End Sub
This is new to me and I am still trying to get my head round it.
Thanks very much.
"Joel" wrote:
Sub finddate()
SearchCol = "A"
words = Array("Chat", "Face*", "Bebo*")
With Sheets("Sheet1")
For Each phrase In words
If Right(phrase, 1) = "*" Then
Set c = Columns(SearchCol & ":" & SearchCol). _
Find(what:=phrase, LookIn:=xlValues, _
lookat:=xlPart)
Else
Set c = Columns(SearchCol & ":" & SearchCol). _
Find(what:=phrase, LookIn:=xlValues, _
lookat:=xlWhole)
End If
If Not c Is Nothing Then
With Sheets("Sheet2")
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
c.EntireRow.Copy _
Destination:=.Rows(LastRow)
End With
End If
Next phrase
End With
End Sub
"BC" wrote:
I am looking to find instances of words within a url that is in a column.
Then select the rows that contain any words from a list and then copy those
selected rows to a second sheet.
I would like to be able to add words and use regular expressions for some
words.
EG
I would like to find the following
Chat
Face*
Bebo*
Any help would be most appreciated.
|