J
jonigr
I lift a worksheet range into an array and determine its maximum but it
doesn't work, the results is always zero (its initial value):
Sub curtest()
Dim currencyarray As Variant
Dim currencymax As Variant
currencyarray = Range("A1:C1").Value
currencymax = Application.Max(currencyarray)
MsgBox currencymax
End Sub
If I first convert the cells number format (manually in the worksheet
itself) from Currency to General or Number than it *does* work.
So I thought of converting the complete currency array (in VBA, like to
singles) but I don't see a way how to do that. One possibility I guess would
be to iterate through each array element but this seems a long detour (I need
to work this on many long currency ranges).
Is there a simpler solution? Thanks very much!
-Joni
doesn't work, the results is always zero (its initial value):
Sub curtest()
Dim currencyarray As Variant
Dim currencymax As Variant
currencyarray = Range("A1:C1").Value
currencymax = Application.Max(currencyarray)
MsgBox currencymax
End Sub
If I first convert the cells number format (manually in the worksheet
itself) from Currency to General or Number than it *does* work.
So I thought of converting the complete currency array (in VBA, like to
singles) but I don't see a way how to do that. One possibility I guess would
be to iterate through each array element but this seems a long detour (I need
to work this on many long currency ranges).
Is there a simpler solution? Thanks very much!
-Joni