title: Find word into cell
body: <p>Excel - VBA
  I was wondering how to find a word into a Excel range of rows using VBA. Ex. "word to be found", this is not just the cell value but a word into a string. For instance, the way to find the word "network" into the string "Need help to map network printer".</p>
  
  <pre><code>Sub SearchForSfb()
  
     Dim LSearchRow As Integer
     Dim LCopyToRow As Integer
  
     On Error GoTo Err_Execute
  
     'Start search in row 1
     LSearchRow = 1
  
     'Start copying data to row 2 in Open (row counter variable)
     LCopyToRow = 2
  
     While Len(Range("E" &amp; CStr(LSearchRow)).Value) &gt; 0
  
        'If value in column E = "word to be found", copy entire row to Open
        If Range("E" &amp; CStr(LSearchRow)).Value = "word to be found" Then
  
           'Select row in Data to copy
           Rows(CStr(LSearchRow) &amp; ":" &amp; CStr(LSearchRow)).Select
           Selection.Copy
  
           'Paste row into SFB in next row
           Sheets("SFB").Select
           Rows(CStr(LCopyToRow) &amp; ":" &amp; CStr(LCopyToRow)).Select
           Sheets("SFB").Paste
  
           'Move counter to next row
           LCopyToRow = LCopyToRow + 1
  
           'Go back to Data to continue searching
           Sheets("Data").Select
  
        End If
  
        LSearchRow = LSearchRow + 1
  
     Wend
  
     'Position on cell A3
     Application.CutCopyMode = False
     Range("A3").Select
  
     MsgBox "All matching data has been copied."
  
     Exit Sub
  
  Err_Execute:
     MsgBox "An error occurred."
  
  End Sub
  </code></pre>