正常情况是,在一个项目中,可以在遍历数据时,顺便计算数目,
可以用字典法,也可以用数组法。
追问大哥给我写写吧,一定好好追加!
追答Public Sub 计数()
Dim CXrng As Range, d, i As Long
Set d = CreateObject("Scripting.Dictionary")
For Each CXrng In Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row)
If CXrng.Value <> "" And Not d.Exists(CXrng.Value) Then
d(CXrng.Value) = ""
i = i + 1
End If
Next
MsgBox i 'I 是不重复个数
End Sub