|
Sub limonet()
Dim Cn As Object, StrSQL$, Rst As Object, i%, Arr As Variant, Brr As Variant
Arr = Array(100, 99, 89, 79, 69, 59)
Set Cn = CreateObject("Adodb.Connection")
Cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0;Data Source=" & ThisWorkbook.FullName
StrSQL = "Select 姓名,partition(int(相似度*100),50,100,10) as Part From [Sheet1$A:C] Union all " _
& "Select 姓名2,partition(int(相似度*100),50,100,10) as Part From [Sheet1$A:C]"
StrSQL = "Select 姓名,mid(part,instr(part,':')+1)*1 as Part From (" & StrSQL & ")"
Set Rst = Cn.Execute(StrSQL)
For i = 0 To UBound(Arr)
Rst.Filter = "Part=" & Arr(i): Brr = Rst.getrows(-1, 0, "姓名")
Range("A2").Offset(, i).Resize(UBound(Brr, 2) + 1, 1) = Application.Transpose(Brr)
Next i
End Sub |
|