|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Function ZFCJS(rgSource As Range) As Variant
- Dim arrSource As Variant, arrResult As Variant
- Dim lngRow As Long
- Dim strTemp As String, strChar As String
- Dim intLen As Integer
- Dim objDic As Object
-
- If rgSource.Count = 1 Then
- ReDim arrSource(1 To 1, 1 To 1)
- arrSource(1, 1) = rgSource
- Else
- arrSource = rgSource
- End If
-
- arrResult = arrSource
- Set objDic = CreateObject("Scripting.Dictionary")
-
- For lngRow = LBound(arrSource) To UBound(arrSource)
- strTemp = arrSource(lngRow, 1)
- strTemp = Trim(strTemp)
- objDic.RemoveAll
- For intLen = 1 To Len(strTemp)
- strChar = Mid(strTemp, intLen, 1)
- If Trim(strChar) <> "" Then objDic(strChar) = ""
- Next
- arrResult(lngRow, 1) = objDic.Count
- Next
- Set objDic = Nothing
- ZFCJS = arrResult
- End Function
复制代码 |
评分
-
1
查看全部评分
-
|