|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Function CZWZ(sr, rng As Range, Optional x As Integer, Optional y As Integer)
If Len(x) = 0 Then CZWZ = "": Exit Function
' y= 0、默认,单元格绝对引用;1、查找列;2、查找行;3、单元格相对引用
Dim d As Object, arr, brr, v, xd, n%
arr = rng
Set d = CreateObject("Scripting.Dictionary")
For Each s In arr
d(i) = ""
Next
brr = d.keys
n = UBound(brr)
For Each s In rng
If s = sr Then '为精确查找
'If InStr(s, sr) Then 为模糊查找
n = n + 1
ReDim Preserve brr(0 To n)
brr(n) = s.Address
End If
Next
If Abs(x) > UBound(brr) Then CZWZ = "": Exit Function
If x < 0 Then x = UBound(brr) + x + 1
v = Split(brr(x), "$")
CZWZ = Choose(y + 1, brr(x), v(1), v(2), v(1) & v(2))
End Function
还是粗心,这么明显我都没看到,该死!谢谢老师指出,今天没花了,明天补上。
|
|