|
本帖最后由 cutecpu 于 2020-5-18 00:12 编辑
- Sub demo()
- Dim arr: arr = Range("A2").Resize(Cells(Rows.Count, "A").End(xlUp).Row - 1, 2)
- i = 2
- While Cells(i, "D") > 0
- L = 1: R = UBound(arr)
- While L + 1 < R
- M = (L + R) \ 2
- If arr(M, 1) < Cells(i, "D") Then L = M Else R = M - 1
- Wend
- If arr(L, 1) >= Cells(i, "D") Then
- Cells(i, "E").Value = "No Match"
- ElseIf arr(R, 1) < Cells(i, "D") Then
- Cells(i, "E").Value = arr(R, 2)
- Else:
- Cells(i, "E").Value = arr(L, 2)
- End If
- i = i + 1
- Wend
- End Sub
复制代码 祝順心,南無阿彌陀佛!
|
评分
-
查看全部评分
|