title: Need to fetch particular string from text file into Excel sheet
body: <p>I need to find a key value pair from text file and paste it in Excel column</p>
  
  <p>There are multiple occurrence of the key value pair till end of file</p>
  
  <ul>
  <li>Key = Response Code which is constant </li>
  <li>Value = not constant changes every time </li>
  </ul>
  
  <p>Example:</p>
  
  <p>Text file :</p>
  
  <pre><code>Username : admin 
  Old password : qqqq
  New password : 1111
  Security question : 1
  Security answer : Mom
  
  Response Code: -500
  
  Operation Completed
  
  Response Code: -100
  ....
  Response Code: -202
  ....
  ....
  </code></pre>
  
  <p>My code :</p>
  
  <pre><code>    Dim myFile As String
      Dim text As String
      Dim textline As String
      Dim x As Integer
  
      myFile = "C:\test\test.log"
      Open myFile For Input As #1
      Do Until EOF(1)
        Line Input #1, textline
        text = text &amp; textline
      Loop
      Close #1
      x = InStr(text, "Response code")
      Range("A1").Value = Mid(text, x + 15, 3)
  </code></pre>
  
  <p><strong>Note</strong>: I am getting only the first occurrence i.e Response Code:-500 
  I want loop that will find all occurrence till end of file and paste that content in Excel sheet column A1.</p>