sorting variables


Posted by joe cic on September 02, 2001 8:16 AM

What's the easiest way to identify the variable(s) of four variables that have the highest value?
dim varA,varB,varC,varD as integer
varA = range("a1")
varB = range("a2")
varC = range("a3")
varD = range("a4")

As an example, suppose a1 holds 2, a2 holds 3, a3 holds 4, a4 holds 4. The solution should return the value 4 or a variable with 4 assigned to it.



Posted by Ted on September 02, 2001 4:42 PM


Range("B1").Value = Application.WorksheetFunction.Max(VarA, varB, varC, varD)

Or

varE = Application.WorksheetFunction.Max(VarA, varB, varC, varD)