我已经了解了网站上的所有编译错误信息,并且我知道它与.Value
有关。我尝试将其设置为= Now
并添加(Now, term.Value)
类似于其他人所做的。有人看到我为什么收到“编译错误:找不到方法或数据成员”的原因
如果您发现words() = Split(term.Value)
代码有什么问题,请随时告诉我:
Sub FindSimilar()
Dim phrases As Range, phrase As Range
Dim terms As Range, term As Range
Dim matches As String
Dim words() As String
'ensure this has the correct sheet names for your workbook
Set phrases = ThisWorkbook.Worksheets("Export").Range("B2:B4345")
Set terms = ThisWorkbook.Worksheets("Topics").Range("D1847:D4847")
For Each term In terms
matches = ""
words() = Split(term.Value)
For i = 0 To UBound(words, 1)
If Len(words(i)) > 2 Then
Select Case words(i)
Case "business", "example", "string"
Case Else
For Each phrase In phrases
If InStr(1, phrase.Value, words(i)) Then
matches = matches & phrase & "/"
End If
Next phrase
End Select
End If
Next i
If matches <> vbNullString Then
term.Offset(0, 6).Value = Left(matches, Len(matches) - 1)
Else
term.Offset(0, 6).Value = "No match"
End If
Next term
End Sub
此外,请注意,此代码运行良好,并且刚刚停止工作,因此我假设它只是更新或一些小文本。我正在使用Excel for Mac。