Excel VBA检查其他单元格中是否包含单元格字

Excel VBA检查其他单元格中是否包含单元格字,vba,excel,Vba,Excel,我想检查一个单元格的所有单词是否包含在另一个单元格的子单词中 例如: A1包含在B1中,但A2不包含在B1中。以下UDF()将确定单元格小中的所有单词是否出现在单元格大中: Public Function AreIn(Little As String, Big As String) As Boolean Dim good As Boolean, aLittle, aBig, L, B AreIn = False aLittle = Split(LCase(Little),

我想检查一个单元格的所有单词是否包含在另一个单元格的子单词中

例如:

A1包含在B1中,但A2不包含在B1中。

以下UDF()将确定单元格中的所有单词是否出现在单元格中:

Public Function AreIn(Little As String, Big As String) As Boolean
   Dim good As Boolean, aLittle, aBig, L, B

   AreIn = False
   aLittle = Split(LCase(Little), " ")
   aBig = Split(LCase(Big), " ")

   For Each L In aLittle
      good = False
      For Each B In aBig
         If L = B Then
            good = True
         End If
      Next B
      If good = False Then Exit Function
   Next L
   AreIn = True
End Function
这里的“单词”是一组不包含空格的字符。该测试不区分大小写。例如:

以下UDF()将确定单元格中的所有单词是否出现在单元格中:

Public Function AreIn(Little As String, Big As String) As Boolean
   Dim good As Boolean, aLittle, aBig, L, B

   AreIn = False
   aLittle = Split(LCase(Little), " ")
   aBig = Split(LCase(Big), " ")

   For Each L In aLittle
      good = False
      For Each B In aBig
         If L = B Then
            good = True
         End If
      Next B
      If good = False Then Exit Function
   Next L
   AreIn = True
End Function
这里的“单词”是一组不包含空格的字符。该测试不区分大小写。例如:


如果你在寻找为你做全部工作的人,你应该提出工作邀请。否则,告诉我们你已经拥有了什么,你的奋斗在哪里。一般来说:将两个单元格的内容拆分成数组,然后用InStr函数逐元素进行比较。如果你在寻找为你完成全部工作的人,你应该提出一份工作邀请。否则,告诉我们你已经拥有了什么,你的奋斗在哪里。一般来说:在数组中拆分两个单元格的内容,然后用InStr函数逐元素进行比较谢谢,我在问题中编辑了你的代码,这就是我的意思。谢谢,我在问题中编辑了你的代码,这就是我的意思。