當前位置:成語大全網 - 新華字典 - Excel 求助:VBA求滿足條件的最大值怎麽寫

Excel 求助:VBA求滿足條件的最大值怎麽寫

Sub maxx()

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

樓上的建立字典來查詢,把簡單的問題搞復雜了。而且占用內存,運行效率會下降。