title: How to enter values in cells in Excel in a column with VBscript
body: <pre><code>Set objReadFile = objFSO.OpenTextFile(objFile.Path, ForReading)
      strAll = Split(objReadFile.ReadAll, vbCrLf, -1, vbTextCompare) 'Gets each line from file
      i = LBound(strAll)
      Do While i &lt; UBound(strAll)
         If (InStr(1, strAll(i), "DAU SNo.-C0", vbTextCompare) &gt; 0) Then
            i = i + 4 'Skip 4 lines to get to first SN
            Do Until InStr(1, strAll(i), "+", vbTextCompare) &gt; 0 'Loop until line includes "+"
               strSNO = Split(strAll(i), "|", -1, vbTextCompare)
               'put strSNO into next cell in column A
               **objSheet.Cells.Offset(1,0).Value = Trim(strSNO(1))**
               i = i + 1
            Loop
         End If
      i = i + 1
      Loop
  </code></pre>
  
  <p>This code splits a text file successfully and puts the two values I want in strSNO(1) and strSNO(2). I want to write them into column A row 2 and column B row 2, then put the next value in row 3 in the next iteration of the loop. I tried the offset method and it gave errors. All the help I am finding is for VBA. Can anyone tell me what to put where the code is in bold to fix it?</p>
  
  <p>EDIT:</p>
  
  <p>Solved it.This is what I did:</p>
  
  <pre><code>strAll = Split(objReadFile.ReadAll, vbCrLf, -1, vbTextCompare) 'Gets each line from file
      i = LBound(strAll)
      c=2
      Do While i &lt; UBound(strAll)
         If (InStr(1, strAll(i), "DAU SNo.-C0", vbTextCompare) &gt; 0) Then
            i = i + 4 'Skip 4 lines to get to first SN
            Do Until InStr(1, strAll(i), "+", vbTextCompare) &gt; 0 'Loop until line includes "+"
              strSNO = Split(strAll(i), "|", -1, vbTextCompare) 
              i = i + 1
              objSheet.Cells(c,1).Offset(1,0).Value = Trim(strSNO(1))
              objSheet.Cells(c,2).Offset(1,0).Value = Trim(strSNO(2))
              c=c+1
              Loop
        End If
      i = i + 1
      Loop
  </code></pre>