Dim i As Integer, max As Currency
max = Cells(1, 2)
For i = 1 To 20
If Cells(i, 1) > max Then
max = Cells(i, 1).Value
End If
Next
MsgBox "最大值是" & max
End Sub
樓上的建立字典來查詢,把簡單的問題搞復雜了。而且占用內存,運行效率會下降。