         For i = 1 To m_iPalette
            With m_tPal(i)
               If (Red = .rgbRed) And (Blue = .rgbBlue) And (Green = .rgbGreen)
                Then
                  ClosestIndex = i
                  Exit Property
               Else
                  lER = Abs(Red - .rgbRed)
                  lEB = Abs(Blue - .rgbBlue)
                  lEG = Abs(Green - .rgbGreen)
                  If (lER + lEB + lEG &lt; lMinER + lMinEB + lMinEG) Then
                     lMinER = lER
                     