title: Find string in table VBA Powerpoint
body: <p>After 2 days trying to find a solution to my problem, I need your help please.
  I'm working on powerpoint VBA script, and I've got a Table (3,3). In the row 1, I've already input some string in cells. </p>
  
  <p>I want to know why my script doesn't want to write NOK in cells when the string does'nt match "comp" for example</p>
  
  <p>Here is my VBA script:</p>
  
  <pre><code>Public Sub CreateTable1()
  ' déclaration of variables
  Dim objSld As Slide
  Dim objShp As Shape
  Dim foundText1 As Object
  Dim FindWhat As String
  Dim I As Integer
  Dim j As Integer
  
  Set objSld = ActivePresentation.Slides(1)
  Set objShp = objSld.Shapes.AddTable(3, 3, 15, 150, 700, 500)
  
  ' Give a name to table
  objShp.Name = "Table1"
  
  ' Define size of cells
  With objSld.Shapes("Table1").Table
      .Columns(1).Width = 115
      .Columns(2).Width = 115
      .Columns(3).Width = 115
      .Rows(1).Height = 120
      .Rows(2).Height = 120
      .Rows(3).Height = 120
  
      'Write in cells
      With .Cell(1, 1).Shape.TextFrame
          .TextRange.Text = "Composition"
      End With
      With .Cell(2, 1).Shape.TextFrame
          .TextRange.Text = "Material"
      End With
      With .Cell(3, 1).Shape.TextFrame
          .TextRange.Text = "Method"
      End With
  
  ' Define text position
      For I = 1 To 3
          For j = 1 To 3
              With .Cell(j, I).Shape.TextFrame
                  .VerticalAnchor = msoAnchorMiddle
                  .HorizontalAnchor = msoAnchorCenter
                  .TextRange.Font.Size = 18
              End With
          Next j
      Next I
  
  'Command find
  'Browse row 1 from line 1 to 3
  For x = 1 To 3
      Set foundText1 = objSld.Shapes("Table1").Table.Cell(x, 1).Shape.TextFrame.TextRange.Find(FindWhat:="Comp")
      If foundText1 = "Comp" Then
          'MsgBox foundText1 &amp; x
          'Will write in cell (x,2) OK and x
          objSld.Shapes("Table1").Table.Cell(x, 2).Shape.TextFrame.TextRange.Text = "OK " &amp; x
      Else
     'Will write in cell (x,2) NOK and x
      'Doesn't works !! Why??
          objSld.Shapes("Table1").Table.Cell(x, 2).Shape.TextFrame.TextRange.Text = "NOK " &amp; x
      End If
  Next x
  End With
  End Sub
  </code></pre>
  
  <p>I Would like to know if you see where is the mistake. The function Else seems not working.. </p>