ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   MAX of ABS of 2 values syntax (https://www.excelbanter.com/excel-programming/421444-max-abs-2-values-syntax.html)

u473

MAX of ABS of 2 values syntax
 
Would this syntax be correct ?

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

Bernie Deitrick

MAX of ABS of 2 values syntax
 
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


"u473" wrote in message
...
Would this syntax be correct ?

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




Bob Phillips[_3_]

MAX of ABS of 2 values syntax
 
That won't work, try this

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


--
__________________________________
HTH

Bob

"u473" wrote in message
...
Would this syntax be correct ?

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




u473

MAX of ABS of 2 values syntax
 
Thank you both.


All times are GMT +1. The time now is 01:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com