cells(4,2)~cells(4,7)
For j = 1 To 5
m = Cells(4, 2)
p = 2
If m < Cells(4, i + 1) Then
m = Cells(4, i + 1)
p = i + 1
End If
Next
s = Cells(4, 7 - j + 1)
Cells(4, 7 - j + 1) = Cells(4, p)
Cells(4, p) = s
Next
Key = Cells(1, 3)
l = 2
r = 7
Do While l <= r
m = Int((l + r) / 2)
If Key > Cells(4, m) Then
l = m + 1
Else
If Key < Cells(4, m) Then
r = m - 1
Else
MsgBox ("在" & m & "找到" & Key)
Exit Do
End If
End If
Loop
If l > r Then
MsgBox ("沒找到" & Key)
End If
阿良掰埃~~
我家的exal cells=()括號中間打,竟然錯誤-.-