|
本帖最后由 ebbe 于 2013-11-8 21:01 编辑
Function DTime(查找值 As Range, 查找范围 As Range, 查找列数 As Integer, 返回列数 As Integer)
LastRow = 查找范围(Rows.Count, 1).End(xlUp).Row
For i = 1 To LastRow
If 查找值 = 查找范围(i, 查找列数) Then
Result = 查找范围(i, 返回列数)
Exit For
End If
Next i
DTime = Result
End Function
我这个的function的作用是,在 查找范围 的“查找列数”内,查找 “查找值”,然后返回查找范围内的 返回列数 的值
例如:
A B
上述数字为查找范围,=Dtime(17,"A1:B7",2,1),那么结果返回值为7。
但是在表格关闭状态下,Vlookup能取到值,但我的函数却不能,且返回#value。请帮忙分析代码是怎么回事
ebbe 发表于 2013-10-31 22:28
对,跨工作表查询,Vlookup就没有问题。我这个DTime就有问题了。
已解决
(, 下载次数: 16)
|
|