can i copy/paste the word which is found during search the word which is found to copied/display its next row(Column)
using this code
please help me
Sub FindAndColor()
Dim cell As Variant
Dim FndWhat As String
Dim RegExp As Object
Dim RngBeg As Range
Dim RngEnd As Range
Dim SearchWords As Variant
Dim Word As Variant
Set RngBeg = Range("F2")
Set RngEnd = Cells(Rows.Count, "F").End(xlUp)
If RngEnd.Row < RngBeg.Row Then Exit Sub
SearchWords = Range(RngBeg, RngEnd).Value
Set RngBeg = Range("D2")
Set RngEnd = Cells(Rows.Count, "D").End(xlUp)
If RngEnd.Row < RngBeg.Row Then Exit Sub
Set RegExp = CreateObject("VBScript.RegExp")
RegExp.IgnoreCase = True
Application.ScreenUpdating = False
For Each Word In SearchWords
RegExp.Pattern = "\b" & Word & "\b"
For Each cell In Range(RngBeg, RngEnd)
If RegExp.Execute(cell).Count > 0 Then
cell.Interior.ColorIndex = 6
cell.Interior.Pattern = xlSolid
End If
Next cell
Next Word
Application.ScreenUpdating = True
End Sub
Bookmarks