我不记得我在哪里找到了这段代码,因此我无法向其作者提供正确的归属,但fuzzy matches
两列字符串
我想更改代码,以便LookWith
列处于coluwn B
而不是列E
我已经尝试了一段时间来执行此操作但是无法在不打破代码
由于
Sub FuzzyMatch()
Dim F As Range, n As Long, c As Long, k As Long 'Taisir
Dim FN As String, SN As String, Z, s As Long, r As Long
For r = 2 To Range("A" & Rows.Count).End(xlUp).Row
SN = Replace(Cells(r, 1), ",", ""): Z = Split(SN): SN = Z(0)
Set F = Range("E:E").Find(SN)
If Not F Is Nothing Then
s = F.Row: FN = Cells(s, 5): c = 1
For n = 1 To UBound(Z): SN = Z(n)
If Len(SN) < 3 Then GoTo GetNextn
Set F = Rows(s).Find(SN)
If Not F Is Nothing Then
c = c + 1
If c >= UBound(Z) - 1 Then
If Cells(s, 6) <> "" Then k = k + 1 Else k = 6
Cells(s, k).Resize(1, 2).Value = Cells(r, 1).Resize(1, 2).Value: End If
GoTo GetNext: End If
GetNextn: Next n: End If
GetNext: Next r
End Sub