[英]In Excel Check phrases in two cell and in the two cell if any listed word found,need to add the word in another cell. repeat this for entire column
My excel file will have two sheets Sheet-1: working sheet我的 excel 文件将有两张表 Sheet-1: working sheet
Column-A : Keyword to be added from macro
Column-B : phrase=1
Column-C : Phrase=2
Compare the two phrases and based on the keyword list in next sheet, add keyword in Column"A".比较这两个短语并根据下一张表中的关键字列表,在“A”列中添加关键字。
Sub Macro5() ' ' 1 Number ' Dim lastrowtofind As Long Range("A8").Activate ActiveCell.FormulaR1C1 = "PFP First Five Description" Sub Macro5() ' ' 1 Number ' Dim lastrowtofind As Long Range("A8").Activate ActiveCell.FormulaR1C1 = "PFP 前五个描述"
lastrowtofind = Sheets(3).Range("A30000").End(xlUp).Row
For k = 9 To lastrowtofind对于 k = 9 到 lastrowtofind
tofind = Sheets(3).Range("AZ" & k).Value
'Broken-->BROK
If tofind = Empty Then
Else
If Sheets(3).Range("AX" & k) = Empty Then
Set rgFound = Sheets(3).Range("AZ" & k).Find("Brok", LookIn:=xlValues)
If rgFound Is Nothing Then
Else
Sheets(3).Range("AX" & k).Value = "BROKEN"
End If
End If
End If
'BURNED-->BULB
If tofind = Empty Then
Else
If Sheets(3).Range("AX" & k) = Empty Then
Set rgFound = Sheets(3).Range("AZ" & k).Find("BULB", LookIn:=xlValues)
If rgFound Is Nothing Then
Else
Sheets(3).Range("AX" & k).Value = "BURNED"
End If
End If
End If
Next k下一个 k
End Sub结束子
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.