VBGood里有人已经回复给楼主了
方法如下
'方法1引用 Microsoft Scripting Runtime
Dim dic As Dictionary
Dim tmp
Dim i As Long
Set dic = New Dictionary
For i = 0 To List1.ListCount - 1
tmp = List1.List(i)
If dic.Exists(tmp) Then
dic.Item(tmp) = dic.Item(tmp) + 1
Else
dic.Add tmp, 1
'第一个
End If
Next
For Each tmp In dic
Debug.Print tmp & "=" & dic.Item(tmp)
Next
set dic=nothing
'方法2纯字符串函数的方法:
Dim i As Long
Dim s As String, tmp As String
ReDim myArray(List1.ListCount - 1)
For i = 0 To List1.ListCount - 1
myArray(i) = List1.List(i)
Next
s = "/" & Join(myArray, "//") & "/"
Do
tmp = "/" & Split(s, "/",3)(1) & "/"
Debug.Print tmp & UBound(Split(s, tmp))
s = Replace(s, tmp, "")
Loop While Len(s)