Does anyone have a function (or snippet) for reordering three variables highest to lowest?

I have three variables: dimA, dimB, and dimC (all as Double).

I need them reordered so that dimC is always the smallest number and dimA is always the largest.

dimA and dimB may be equal as long as they are larger than dimC.

dimB and dim C may be equal as long as they are smaller than dimA.

If dimA, dimB, and dimC are all equal, nothing needs to change.

I made some If, Then, Else statements but there is a bug I couldn't figure out (it has been deleted).

Thanks,

Todd

Best way to do this is to assign your values to an array like so:

Option Explicit

Dim dblA, dblB, dblC, dblTemp As Double

Dim dblArray(0 To 2) As Double

Dim i, j As Integer

Sub main()

dblA = 3

dblB = 4

dblC = 1

dblArray(0) = dblA

dblArray(1) = dblB

dblArray(2) = dblC

For i = 0 To UBound(dblArray)

For j = i + 1 To UBound(dblArray)

If dblArray(i) < dblArray(j) Then

dblTemp = dblArray(i)

dblArray(i) = dblArray(j)

dblArray(j) = dblTemp

End If

Next j

Next i

dblA = dblArray(0)

dblB = dblArray(1)

dblC = dblArray(2)

End Sub

If you want to use more values just change the length of the array