It needs to search Key word in the Column.
If its Found The same key word needs to updated next column for the Found Rows
I'm trying to write a code that searches List of Key word in my excel worksheet column "B" and then If The Key word found, Group the All Found Rows updated Same key word Next Column.
There are lots of occurrences of the particular word in the worksheet. All I want to do is to search for the these occurrences and then Group the all rows that contains those words. My problem is that I'm not sure what loop structure to use. Below is the code I'm using.
Sub TestDeleteRows()
Dim rFind As Range
Dim rDelete As Range
Dim strSearch As String
Dim sFirstAddress As String
'Dim SearchRange As Range
'Set SearchRange = ThisWorkbook.Worksheets("KeyWords").Range("A1:A5")
strSearch = "Password"
Set rDelete = Nothing
Application.ScreenUpdating = False
With Sheets("Tags").Columns("B:B")
Set rFind = .Find(strSearch, LookIn:=xlValues, _
LookAt:=xlPart, SearchDirection:=xlNext, MatchCase:=False)
If Not rFind Is Nothing Then
sFirstAddress = rFind.Address
Do
If rDelete Is Nothing Then
Set rDelete = rFind
Else
Set rDelete = Application.Union(rDelete, rFind)
End If
Set rFind = .FindNext(rFind)
Loop While Not rFind Is Nothing And rFind.Address <> sFirstAddress
rDelete.Offset(rDelete, 1).Value = strSearch 'I am not getting the output Hear
End If
End With
Application.ScreenUpdating = True
End Sub