|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 按钮1_Click()
Range("d2:d65535").ClearContents
Dim dic As Object
Set dic = CreateObject("Scripting.Dictionary")
Set cnn = CreateObject("adodb.connection")
cnn.Open "provider=microsoft.jet.oledb.4.0;extended properties=excel 8.0;data source=" & ThisWorkbook.FullName
Sql2 = "select * from [sheet1$a:a] where 文字列 is not null order by len(文字列)"
Set rst2 = CreateObject("adodb.Recordset")
rst2.Open Sql2, cnn, 1, 1
Do While Not rst2.EOF
b2 = rst2("文字列")
If Not dic.exists(b2) Then
k = 0
For Each a2 In dic.keys
If InStr(b2, a2) > 0 Then k = 1: Exit For
Next
If k = 0 Then dic(b2) = ""
End If
rst2.movenext
Loop
cnn.Close
Set cnn = Nothing
[d2].Resize(dic.Count, 1) = Application.Transpose(dic.keys)
End Sub
测试2.zip
(14.95 KB, 下载次数: 3)
|
评分
-
1
查看全部评分
-
|