|
好久没有练习,试试看还记得多少^_^
Sub MIN()<br/>Dim arr0, arr, i As Integer, S As Integer<br/>arr0 = Range("A1:A" & Cells(65536, 1).End(xlUp).Row)<br/>ReDim arr(1 To UBound(arr0))<br/>For i = 1 To UBound(arr0)<br/> arr(i) = Abs(100 - arr0(i, 1))<br/>Next i<br/>S = Application.WorksheetFunction.Match(Application.WorksheetFunction.MIN(arr), arr, 0)<br/>MsgBox "最接近的数值是" & Cells(S, 1) & ",地址是" & Cells(S, 1).Address<br/>End Sub<br/> |
|