title: How to assign a value to a cell?
body: <p>I am trying to import a text file and process it in Excel.</p>
  
  <p>First step is to split the data into 2 groups: Headers and content.</p>
  
  <p>I have creates two worksheets. Then import text data. Then determine the Height, Width and number of items of the data file.</p>
  
  <p>The issue comes trying to copy the headers data to one of the worksheets. I am getting no value.</p>
  
  <p>I have tried assigning as value:</p>
  
  <pre><code>Worksheets("TIME").Range(Cells(j, k)).Value = Range(Cells(i, k)).Value
  </code></pre>
  
  <p>As fixed value:</p>
  
  <pre><code>Worksheets("TIME").Range(Cells(j, k)).Value = 1
  </code></pre>
  
  <p>I placed a counter on the loops and they are working properly.</p>
  
  <pre><code>On Error Resume Next
  Worksheets.Add.Name = "RAW"
  Worksheets.Add.Name = "TIME"
  Sheets("RAW").Select
  
  'Import and copy data to RAW sheet. It is working so I did not copy it.
  
  Range("A1").End(xlToRight).Select
  WidthFile = ActiveCell.Column
  Range("A1").End(xlDown).Select
  HeightFile = ActiveCell.Row
  Range("A1").Select
  NumberObs = Application.WorksheetFunction.CountIf(ActiveSheet.Range _
                (Cells(1, 1), Cells(HeightFile, 1)), Range("A1").Value)
  Sample = Range("A1").Value
  j = 1
  
  For i = 2 To HeightFile
      If Range(Cells(i, 1)).Value = Sample Then
          For k = 1 To WidthFile
              Worksheets("TIME").Range(Cells(j, k)).Value = _
                                 Range(Cells(i, k)).Value
          Next
          j = j + 1
      End If
  Next
  </code></pre>
  
  <p>I expected as import data the rows on RAW Worksheet which first cell it is matching with the first cell on "RAW" Worksheet copied on "TIME" Worksheet. I got a blank worksheet.</p>
  
  <p>The data file I get in RAW Worksheet is like:<br>
  <a href="https://i.stack.imgur.com/1B3z4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1B3z4.jpg" alt="RAW DATA"></a></p>
  
  <p>The expected result on TIME Worksheet should be:<br>
  TIME Worksheet expected result sample<br>
  <a href="https://i.stack.imgur.com/jCFHA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jCFHA.jpg" alt="TIME DATA"></a></p>