答案1
以下是您可以使用的 VBA 函数:
Public Function ListMissingWords(WordsToSearch As String, TextToSearch As String) As String
Dim AllWords As Variant
Dim i As Integer
Dim TempResult As String
On Error GoTo ErrLabel
AllWords = Split(WordsToSearch, ",")
For i = LBound(AllWords) To UBound(AllWords)
If Not InStr(LCase(TextToSearch), LCase(AllWords(i))) > 0 Then
TempResult = TempResult & AllWords(i) & ","
End If
Next i
If TempResult <> "" Then
TempResult = Left(TempResult, Len(TempResult) - 1)
End If
ListMissingWords = TempResult
Exit Function
ErrLabel:
Err.Clear
End Function
插入方法:
- 在 Excel 中按 Alt+F11
- 右键单击工作簿的名称并选择“插入”-“模块”
- 插入代码
现在您可以在工作簿中使用此功能:
您需要将文件保存为启用宏的 Excel 工作簿 (.xlsm)