graceface21
New Member
- Joined
- Aug 17, 2021
- Messages
- 8
- Office Version
- 2019
- Platform
- Windows
Hi,
I am brand new to VBA and I want to search for a bunch of keywords in one column that contains additional text like in each cell. I want to search for the keywords in each cell and paste them to an adjacent cell all by clicking a macro. How do I accomplish this?
So far I have the follow; however, it is not copying over to the adjacent cell.
Private Sub COQ_click()
COQcodes = "happy|sad|mood"
strFind = Split(COQcodes, "|")
row_number = 0
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheet5.Range("M" & row_number)
For Each iCell In Selection
For i = LBound(strFind) To UBound(strFind)
If InStr(UCase(iCell.Value), UCase(strFind(i))) > 0 Then
iCell.Offset(, 1).Resize(1, 3).Copy
GoTo NextOne
End If
Next i
NextOne:
Next iCell
Loop Until row_number = 12800
End Sub
I am brand new to VBA and I want to search for a bunch of keywords in one column that contains additional text like in each cell. I want to search for the keywords in each cell and paste them to an adjacent cell all by clicking a macro. How do I accomplish this?
So far I have the follow; however, it is not copying over to the adjacent cell.
Private Sub COQ_click()
COQcodes = "happy|sad|mood"
strFind = Split(COQcodes, "|")
row_number = 0
Do
DoEvents
row_number = row_number + 1
item_in_review = Sheet5.Range("M" & row_number)
For Each iCell In Selection
For i = LBound(strFind) To UBound(strFind)
If InStr(UCase(iCell.Value), UCase(strFind(i))) > 0 Then
iCell.Offset(, 1).Resize(1, 3).Copy
GoTo NextOne
End If
Next i
NextOne:
Next iCell
Loop Until row_number = 12800
End Sub