No interest expressed.

Alright then.


Code:
    Public Function DETERMINE_TARGVALS_CELL_MIN_MAX(ByRef mCellLow As Integer, ByRef mCellHigh As Integer, ByVal mTargVal As Integer, ByVal mBaseCellCount As Integer) As Boolean
        Dim mBaseCellCount_m1 As Integer = mBaseCellCount - 1
        Dim mBaseCellCount_m2 As Integer = mBaseCellCount - 2
        Dim mBaseCellCount_PackedSum As Integer = (mBaseCellCount_m1 * mBaseCellCount_m2) / 2

        Dim mTemp As Integer = mTargVal - mCellLow * mBaseCellCount_m1 - mBaseCellCount_PackedSum
        If mCellHigh > mTemp Then
            mCellHigh = mTemp
        End If

        mTemp = mTargVal - mCellHigh * mBaseCellCount_m1 + mBaseCellCount_PackedSum
        If mCellLow < mTemp Then
            mCellLow = mTemp
        End If

        If mCellLow > mCellHigh Then
            Return False
        End If

        Return True
    End Function
    Public Function DETERMINE_MUST_USE_RANGES(ByRef mCellLow As Integer, ByRef mCellHigh As Integer, ByVal mTargVal As Integer, ByVal mBaseCellCount As Integer, _
                                                ByRef mMustUseLowCount As Integer, ByRef mMustUseHighCount As Integer, ByRef mFreeCells As Integer) As Boolean

        Dim mAdjustedTargVal As Integer = mTargVal - mBaseCellCount * mCellLow
        Dim mAdjustedLowCell As Integer = 0
        Dim mAdjustedHighCell As Integer = mCellHigh - mCellLow

        Dim mAbsoluteMinVal As Integer = (mBaseCellCount * (mBaseCellCount - 1)) / 2
        Dim mAbsoluteMaxVal As Integer = mBaseCellCount * mAdjustedHighCell - mAbsoluteMinVal

        Dim mLowDifference As Integer = madjustedTargVal - mAbsoluteMinVal
        Dim mHighDifference As Integer = mAbsoluteMaxVal - mAdjustedTargVal

        mMustUseLowCount = mBaseCellCount - mLowDifference
        mMustUseHighCount = mBaseCellCount - mHighDifference

        If mMustUseLowCount < 0 Then
            mMustUseLowCount = 0
        End If
        If mMustUseHighCount < 0 Then
            mMustUseHighCount = 0
        End If

        'mFreeCells = mBaseCellCount - mMustUseLowCount - mMustUseHighCount
        'If mFreeCells < 0 Then
        '    mFreeCells = 0
        'End If
        'error conditions?

        If mMustUseLowCount > mBaseCellCount Then
            Return False
        End If
        If mMustUseHighCount > mBaseCellCount Then
            Return False
        End If
        'IS there any way that, if either of the MustUseCounts equals mbasecellcount, the other doesn't?

        Return True
    End Function