MSFlexGrid のセル内を検索する
                                                         玄関へお回り下さい。
MSFlexGrid のセル内を検索する                  (209)
       Option Explicit   'SampleNo=209 WindowsXP VB6.0(SP5) 2002.09.14

Private Sub Command1_Click()
'完全一致検索
  Dim Ro   As Long
  Dim Co   As Long
  Dim Ret  As Long
  With MSFlexGrid1
    For Ro = .FixedRows To .Rows - 1
      For Co = .FixedCols To .Cols - 1
        If Text1.Text = .TextMatrix(Ro, Co) Then
          .Col = Co
          .Row = Ro
          .TopRow = Ro
          Ret = MsgBox("これですか", vbYesNo)
          If Ret = vbYes Then
            Exit Sub
          End If
        End If
      Next Co
    Next Ro
  End With
End Sub


Private Sub Command2_Click()
'前方一致検索
  Dim Ro   As Long
  Dim Co   As Long
  Dim Ret  As Long
  With MSFlexGrid1
    For Ro = .FixedRows To .Rows - 1
      For Co = .FixedCols To .Cols - 1
        If InStr(.TextMatrix(Ro, Co), Text1.Text) Then
          .Col = Co
          .Row = Ro
          .TopRow = Ro
          Ret = MsgBox("これですか", vbYesNo)
          If Ret = vbYes Then
            Exit Sub
          End If
        End If
      Next Co
    Next Ro
  End With
End Sub