我试图获得数组中的最高值。我写了一个代码,它工作正常,但结果是一个舍入值。 我想要99,98而不是100.
你能帮我解决这个问题吗?
Dim aArray() As Double
ReDim aArray(0 To 1) As Double
For Each Row_cell In Range("A1:A100")
If Row_cell.Value = "Admin" Then
TargetRow = Row_cell.Row
End If
Next Row_cell
For Each Column_Cell In range("b1:x1")
If Column_Cell.Value = country_name Then
TargetCol = Column_Cell.Column
If (IsNumeric(Cells(TargetRow, TargetCol)) And Cells(TargetRow, TargetCol) <> 0) Then
aArray(UBound(aArray)) = Cells(TargetRow, TargetCol).Value
ReDim Preserve aArray(0 To UBound(aArray) + 1)
End If
End If
Next Column_Cell
maximum_value = Application.WorksheetFunction.Max(aArray)
high_sheet.Cells(j, i) = maximum_value
Erase aArray
ReDim aArray(0 To 1) As Double