|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
用VBA试了一下
Sub 提取关键字()
Dim i As Integer, j As Integer
For i = 2 To Cells(1, 1).End(xlDown).Row
For j = 2 To Cells(1, 6).End(xlDown).Row
t = Application.Find(Cells(j, 6), Cells(i, 1))
s = Application.IfError(Application.Find(Cells(j, 6), Cells(i, 1)), 0)
If s > 0 Then
If Cells(i, 2) = "" Then
Cells(i, 2) = Cells(j, 6)
Else
Cells(i, Cells(i, 2).Column + 1) = Cells(j, 6)
If Cells(i, Cells(i, 2).Column + 1) = Cells(i, 2) Then Cells(i, Cells(i, 2).Column + 1).Clear
End If
If Cells(i, 2) = "餐" Then Cells(i, 2) = "临时"
End If
Next j
Next i
End Sub |
|