title: Reading a specific part of a text line using VBA
body: <p>I am trying to get the 827th line from a text file to write in a cell. There are a lot of files like this so that is why I am trying to use a macro. The text file looks like this</p>
  
  <pre><code>"Drag Convergence"
  "Iterations" "cd"
  1     7.74776e-01
  2     6.51021e-01
  3     5.58885e-01
  .....
  824     3.57617e-01
  825     3.57617e-01
  </code></pre>
  
  <p>I just want to write the number "3.57617e-01" to a cell. I can do the cell arrangement myself but I did not have a good way to read that value and then write it to a cell lets say (1,1)</p>
  
  <p>My file location is </p>
  
  <pre><code>strFile = "D:\Analiz\Database\NACA63220_" &amp; Mach(k) &amp; Alpha(j) &amp; Letter(i) &amp; ".txt"
  </code></pre>
  
  <p>What I did was using</p>
  
  <pre><code>strPath = "D:\Analiz\Database\"
  strExt = ".txt"
  strSection = "Lift Convergence"
  strValue = "825     "
  
  With shtResult
       .Cells(1,1).Value = strValue
  End With
  
  strFile = "D:\Analiz\Database\NACA63220_" &amp; Mach(k) &amp; Alpha(j) &amp; Letter(i) &amp; ".txt"
  
  Set data=shtSource.QueryTables.Add(Connection:TEXT;" &amp; strPath &amp; strFile, Destination:=shtSource.Cells(1, 1))
  
  With data
  .TextFileStartRow = 1
  .TextFileParseType = xkDelimited
  .TextFileVonsecutiveDelimeter = False
  .TextFileTabDelimiter = False
  .Text FileSemicolonDelimiter = False
  .TextFileCommaDelimiter = False
  .TextFileSpaceDelimiter = False
  .TextFileColumnDataTypes = Array(1)
  .TextFileTrailingMinusNumbers = True
  
  .Refresh BackgroundQuery:=False
  End With
  
  Set fndSection = data.ResultRange.Find(strSection)
  Set fndValue = data.ResultRange.Find(strValue, fndSection)
  shtResult.Cells(shtResult.Rows.Count, 1).End(xkUp).Offset(1).Value = Replace(findValue, strValue, "")
  </code></pre>
  
  <p>This gives a run time error 1004, and when I press debug, it highlights the line with .Refresh BackgroundQuery</p>
  
  <p>I did not put everything here like dimensioning etc because I have to use my phone to access this site so I am writing all of the codes with my phone again.</p>
  
  <p>Edit: I added more lines, the problem highlights the Refresh Background Query line when I press debug.
  I was actually trying to implement this by tweaking to my problem:</p>
  
  <p><a href="https://stackoverflow.com/questions/37220488/importing-data-from-multiple-text-files-into-excel-vba">Importing data from multiple text files into Excel VBA</a></p>