[INCLUDE]
ctInterpretA_CompareVals

[CODE]
Private Sub ctInterpretA_CheckFor(ByRef ctString As String, ByVal CalcOption As String)
  Dim xLeft As Long
  Dim xRight As Long
  Dim xFinder As Long
  Dim xValL As String
  Dim xValR As String
  Dim xResult As Boolean

  xFinder = 1&
  Do
    xFinder = InStr(xFinder, ctString, CalcOption)
    If xFinder < 2 Or xFinder > Len(ctString) - 2& Then Exit Sub
    xLeft = xFinder
    Do
      If xLeft = 1& Then Exit Do
      If InStr(ConstVals, Mid(ctString, xLeft - 1&, 1&)) = 0& Then Exit Do
      xLeft = xLeft - 1&
      Loop
    xRight = xFinder - 1& + Len(CalcOption)
    Do
      If xRight = Len(ctString) Then Exit Do
      If InStr(ConstVals, Mid(ctString, xRight + 1&, 1&)) = 0& Then Exit Do
      xRight = xRight + 1&
      Loop
    If xRight > xFinder - 1& + Len(CalcOption) And xLeft < xFinder Then
      If Not (xLeft = 0& Or xRight = Len(ctString)) Then
        If InStr("-^*/#+)", Mid(ctString, xLeft - 1&, 1&)) = 0& And _
          InStr("-^*/#+(", Mid(ctString, xRight + 1&, 1&)) = 0& Then
          xValL = Mid(ctString, xLeft, xFinder - xLeft)
          xValR = Mid(ctString, xFinder + Len(CalcOption), xRight - (xFinder - 1& + Len(CalcOption)))
          xResult = 0&
          Select Case CalcOption
            Case ">=", "=>": If Val(xValL) >= Val(xValR) Then xResult = 1&
            Case "<=", "=<": If Val(xValL) <= Val(xValR) Then xResult = 1&
            Case "<>", "|": If Val(xValL) <> Val(xValR) Then xResult = 1&
            Case "=": If Val(xValL) = Val(xValR) Then xResult = 1&
            Case "<": If Val(xValL) < Val(xValR) Then xResult = 1&
            Case ">": If Val(xValL) > Val(xValR) Then xResult = 1&
            End Select
          If xResult Then
            xValL = "1"
            Else
            xValL = "0"
            End If
          ctString = Left(ctString, xLeft - 1&) + xValL + Mid(ctString, xRight + 1&)
          xFinder = xLeft
          End If
        End If
      End If
    xFinder = xFinder + 1&
    Loop
  End Sub