MAX of ABS of 2 values syntax

U

u473

Would this syntax be correct ?

Var1 = WorksheetFunction.Max(WorksheetFunction.Abs
(Rng1),WorksheetFunction.Abs(Rng2))
Thank you for your help,
J.P.
 
B

Bernie Deitrick

JP,

If you have only one cell in each range, then use

Var1 = Application.WorksheetFunction.Max(Abs(rng1.Value), Abs(rng2.Value))

VBA has its own ABS function, so the worksheetfunction is not needed in that case.

HTH,
Bernie
MS Excel MVP
 
B

Bob Phillips

That won't work, try this

Var1 = Evaluate("MAX(ABS(" & rng1.Address & "),ABS(" & rng2.Address &
"))")
 
Top