|
本帖最后由 meet10010 于 2015-1-16 18:42 编辑
自定函数求个数问题
- Function zd1(rng1, rng2)
- Dim d, i&, j%
- Set d = CreateObject("scripting.dictionary")
- h = rng1.Rows.Count
- l = rng1.Columns.Count
- For i = h To 1 Step -1
- For j = 1 To l
- d(rng1(i, j).Value) = ""
- If d.Count = 5 Then GoTo line1
- Next
- Next
- line1:
- For Each c In rng2
- If d.exists(c.Value) Then s = s + 1
- Next
- zd1 = s
- End Function
- Function zd2(rng1, rng2)
- Dim d, i&, j%
- Set d = CreateObject("scripting.dictionary")
- h = rng1.Rows.Count
- l = rng1.Columns.Count
- For i = h To 1 Step -1
- For j = l To 1 Step -1
- d(rng1(i, j).Value) = ""
- If d.Count = 5 Then GoTo line1
- Next
- Next
- line1:
- For Each c In rng2
- If d.exists(c.Value) Then s = s + 1
- Next
- zd2 = s
- End Function
复制代码
|
|