
Private Function Maximum(rR As Single, rG As Single, rB As Single) As Single
   If (rR &gt; rG) Then
      If (rR &gt; rB) Then
         Maximum = rR
      Else
         Maximum = rB
      End If
   Else
      If (rB &gt; rG) Then
         Maximum = rB
      Else
         Maximum = rG
      End If
   End If
End Function
Private Function Minimum(rR As Single, rG As Single, rB As Single) As Single
   If (rR &lt; rG) Then
      If (rR &lt; rB) Then
         Minimum = rR
      Else
         Minimum = rB
      