|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Function CZWZ(sr, rng As Range, Optional x As Integer, Optional y As Integer)
If Len(x) = 0 Then 查找行列 = "": 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 查找行列 = "": 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
只是把查找行列改成了CZWZ,其它地方都没动。
|
|